Problem/Motivation
ImageMagick supports a fairly wide range of image formats, but the toolkit implementation is currently limiting the actual image formats processed within Drupal, by hardcoding the supported image extensions in ::getSupportedExtensions(). Extending that list is not a good idea because different builds of ImageMagick may or may not support specific image formats.
Ideally, the list of supported format should be configurable in admin: the site admin check what ImageMagick formats are supported by its specific implementation, then lists those that wants to be supported by the toolkit. A minimum, non overrideable default could be JPEG, PNG and GIF to provide parity with core's GD toolkit.
Proposed resolution
Wait for #2311679: Separate MIME type mapping from ExtensionMimeTypeGuesser to be committed. Then, introduce a field in the toolkit config form for the site admin to list the formats to be supported, in ImageMagick internal notation. These can be implicitly or explicitly mapped to MIME types. With the list of MIME types supported, resolve the entire list of file extensions supported, and that to be returned by ::getSupportedExtensions(). If getimagesize() is used instead of the identify command, return the same list of core's GD supported extensions. Some caching may be needed.
Remaining tasks
Wait on #2311679: Separate MIME type mapping from ExtensionMimeTypeGuesser
User interface changes
Additional field(s) to manage toolkit's supported image formats
API changes
None
Data model changes
Config schema changes to manage toolkit's supported image formats
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2612590-7.patch | 41.62 KB | mondrake |
| #7 | interdiff_6-7.txt | 5.17 KB | mondrake |
| #6 | 2612590-6.patch | 38.15 KB | mondrake |
Comments
Comment #2
mondrakeAn initial patch, just implementing the UI. Image formats will be enabled/disabled by editing a YAML map. For each format, it will be specified:
Comment #3
mondrakeComment #4
mondrakeFound a workaround for #2311679: Separate MIME type mapping from ExtensionMimeTypeGuesser. Working on a patch.
Comment #5
mondrakeThis seems to work, it adds two services - one
imagemagick.format_mapperthat handles the relationshiphs 'internal ImageMagick format' <-> 'MIME type' <-> 'file extension', and one 'workaround' to the to-be mime type mapper service that will be introduced by #2311679: Separate MIME type mapping from ExtensionMimeTypeGuesser. Once that will be in, the workaround shall be removed. I will open an issue for that.We would need to add some more instructions, was thinking about adding a section to README.txt
Comment #6
mondrakeSome more tests for the toolkit setup form.
Comment #7
mondrakeComment #9
mondrakeComment #10
mondrake