firebaseco/mongoose-attachments — pull request #7 by nuarhu (2012-10-18 11:35:31+00:00)
Title: Option to use ImageMagick formats for supportedDecodingFormats

Hi,

there is a new method that parses the output of 'convert -list format'. It is able to check for all the modes: read, write, multi (support for multiple images), blob (native blob support). The modes can be combined.

I've also added the function

plugin.registerImageMagickDecodingFormat()

which populates supportedDecodingFormats with all ImageMagick formats supporting 'read'. This function has to be called explicitly before configuring the mongoose model - otherwise the plugin behaves as before.

Maybe it would be good to change the default behaviour but that is something for you to decide.

Reasons for making it the default (IMHO):
- The current list is hard coded and includes TIFF but TIFF is not a format which is included by default in ImageMagick on all operating systems. For example, on my mac, it's not supported (not even listed). See here:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=20635
It's probably handled correctly because of identify() but it's not that nice to include it in the hard coded list like its support would be granted?
- Why have a hard coded list if the actual list of formats supported by ImageMagick is available? If a client wants to filter on certain formats they should do that outside of mongoose-attachments - they should be validating the user input before even calling 'save'.

This pull request also contains a /test/ folder and a test script. I have not added any test frameworks, though. The test is simply called with node from the commandline.

Once it is in, the README should be updated appropriately. (I can do that.)

Cheers,
Chantal