Hi
I'm working with a gallery 2.3 installation with checkout and checkout-download modules installed. We're quite happy about it, but there's one option we seem to be missing. We would like our customers to be able to download images in different formats; either a tif or a jpg. We still wan't them to do it via ckeckout's cart and as a zip catalogue.
It seems like it's not possible at the moment, so what would be the right approach; should I try to extend/modify the download module or should I fork it and make the changes. Can't seem to find the right place for feature-requests.
Kind Regards
Morten
Posts: 8339
A customization like that you'd have to do yourself. (or hire it out)
Gallery currently does not support derivatives of different mime types.
But it has been done.
In the transcode module we create a new derivative of a different mime:
and then later for presentation - or in your case zip/download - we fetch all derivatives and loop through them for the derivative w/ the proper mimeType and deliver.
You have to make sure you have a supporting toolkit to create all your mime types - ImageMagick can handle most.
@see http://codex.gallery2.org/Gallery2:API
-s
Posts: 8
Well, the company did hire it out... to me ;-)
Thanks for the info, I'll look into it.
Maybe I should just have it working before bothering on how to submit anything back...
Posts: 8
So, I've found out that Gallery actually does support converting images to different formats...
I have made a working solution for my client, but I recon it would be appropriate to submit it back as a patch for checkout download. For it to be usable in general I need to make some adjustments, though
Is there a way to get a list of supported mimetypes by all the image toolkits that are installed on a given system (some kind of "getSupportedMimeTypes()" operation)
Also the convertMimeToExtensions seem to be giving extensions back in a rather unstructured way depending on the mime.
Eg. image/jpeg gives {jpg, jpeg, jpe} and image/tiff gives {tiff, tif}. I would like to use a 3-letter extension to be on the safe-side, so maybe the order could be standardized for all mime-types (eg. {common-3-letter, common-4-letter[,other]}.
/morten
Posts: 8339
the thumbnail module does that
@see modules/thumbnail/classes/ThumbnailHelper.class getMimeTypeMap
Gallery uses these two methods to convert back and forth
http://gallery.menalto.com/apidoc/GalleryCore/Classes/GalleryCoreApi.html#methodconvertExtensionToMime
http://gallery.menalto.com/apidoc/GalleryCore/Classes/GalleryCoreApi.html#methodconvertMimeToExtensions
and you can edit which extensions and what order with the MIME Maintenance module. Gallery Admin -> MIME Types
-s
Posts: 8
Thanks again.
I did find the MIME Types module, that obviously also gets a map of supported MIME-types.
Wouldn't the recommended method be to use the GalleryCoreApi::getMapEntry method rather than creating a database-query?
Editing the mime-types doesn't seem to have any effect on what order the extensions are listed. The image/tiff type have extentions tiff and tif. Even if I delete tiff and add it again afterwards, it's still first in the list.
However, I don't think it's a viable solution for a module to depend on a gallery administrator to type the extensions in the right order. That would just break the module in too many cases. A better solution would probably be to search the extension array for the first 3-letter extension. Or should I just take the first? Doesn't most systems support 4-letter extensions these days? I'm mostly linux user, so I'm not sure about this...
Posts: 8339
both build a query.
but ThumbnailHelper::getMimeTypeMap does exactly what you want.
and other ThumbnailHelper methods can be useful too ThumbnailHelper::fetchToolkitSupport
You could either duplicate these methods to remove dependencies or require the thumbnail module be present.
-s