Allowing module defined file types (like .avi) in Gallery

View: New views
1 Messages — Rating Filter:   Alert me  

Allowing module defined file types (like .avi) in Gallery

by Eric Cavaliere :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

nivekiam suggested I post this over here.

I've been looking into modifying Gallery 3 to support additional file
types via modules.  The problem I've run into is that Gallery's API
doesn't really support this.  File types, extensions, etc are mostly
hard coded into Gallery and not very configurable.  After some trial
and error, I have managed to edit parts of Gallery and the server add
module to allow for .avi files to be added into Gallery.  The changes
I've made include --

Server Add Modifications:
Edited server_add/controllers/server_add.php to include lines 51-53
and 129-131 to allow for additional file extensions.  Also added lines
247-250 to allow module defined create functions.
http://github.com/rWatcher/gallery3/blob/master/modules/server_add/controllers/server_add.php

Gallery 3 Modifications:
Created file gallery/libraries/File_Extensions.php to maintain an
array of file types that can be added onto by module::event functions.
http://github.com/rWatcher/gallery3/blob/master/modules/gallery/libraries/File_Extensions.php

Edited gallery/helpers/MY_url.php to include lines 38-40 to allow for
module-defined controllers.
http://github.com/rWatcher/gallery3/blob/master/modules/gallery/helpers/MY_url.php

Edited gallery/models/item.php to include lines 219 - 220, 226, 248 -
249, and 255 to allow modules to define an item type with a .jpg thumb
when the full size is not a jpeg.
http://github.com/rWatcher/gallery3/blob/master/modules/gallery/models/item.php

Edited gallery/helpers/graphics.php to include lines 123-126 for
allowing modules to specify item types that do not have a resize and
lines 137-138 plus line 142 to define additional item types that use
ffmpeg for thumbnails.
http://github.com/rWatcher/gallery3/blob/master/modules/gallery/helpers/graphics.php

Note that this has not been thoroughly tested.  It's possible that
there could be other areas of Gallery that would also need to be
modified, that I haven't stumbled across yet.  I've basically been
editing files one at a time to fix whatever issue I ran into after the
previous edit :)

An example .avi can be found in my testing gallery here:
http://eric2001.brinkster.net/gallery3/index.php/AVI-Upload-Test/MVI_1908
As Gallery's video player doesn't support .avi files, I've programmed
the site to just display a direct link to it allowing the web browser
to decide if it should be played in the browser or downloaded.

Comments?  Suggestions?  Any better ideas?

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
__[ g a l l e r y - d e v e l ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]