Hi all,
I'm creating a module (with gallery2.3) that will create a new derivative type and handle the rendering of it. Is there a "correct" way to do this. I'd like to do this entirely within the module, but there doesn't seem to be a way to register a new type without hacking the core classes. Any suggestions?
Thanks
Posts: 4342
Interesting. What's your derivative going to be?
Posts: 5
I've written a module to allow me to embed the IIPImage high resolution image viewer (see http://iipimage.sf.net) into Gallery. But, as the system requires images to be in a tiled multi-resolution TIFF format, I've created a special derivative type and a toolkit to generate these. The module renderer can then embed the Ajax viewer if the image is suitably flagged.
I think doing this as a new kind of derivative image makes sense. The problem is that derivative type information is hard-wired into the Gallery core. Perhaps there is a better way to do this than via a derivative? Any suggestions would be welcome.
Posts: 4342
Could it not be handled as a new type of GalleryItem?
Posts: 5
The tiled multi-resolution image needs to be generated by Gallery from the source image so logically it's a kind of derivative image. Perhaps it could be done through a GalleryItem but it seems to me even more of a hack than changing the derivative types!
Posts: 4342
ok... engaging brain now...
Derivatives can be of any MIME-type, and your derivativeOperations string has your custom operation which is handled only by your custom toolkit. Why therefore does it have to be a new *kind* of derivative? Can it not be just another resize?
Posts: 5
I guess this could be a solution. Although the image is not resized in any way, I could just mark it as such to simplfy things.
Posts: 4342
Otherwise yes I think you have to hack core. I was interested once in creating a Black-and-white derivative type, but I think I decided it would have to be classed as a "resize".
Posts: 8339
For the transcode module, since there are no movie derivatives, we cheat, and just change the renderer on the source to the FlashVideoRenderer, and present the transcoded version as the preferred.
Then when searching for pre-existing derivatives of that type or we want to work on the transcoded derivative, we check the derivative operations for a "convert-to-video/flv" string.
There was talk of adding other derivative types, but I don't think it will happen.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 5
Well, thanks guys, I've now got it working as a fake resize type
Posts: 27300
Did not read the whole thread but this pops up:
http://gallery.menalto.com/node/80713
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team