[Drupal] Drupal 7 image field support for TIFF images

April 29, 2013 - 14:51

In Drupal 7 Image module offers an image field which makes available an image widget for file fields that can be added to content types. This will allow for upload of images to the image field which can then later be processed by the image module and be presented using the different image styles as configured. This means that image module should have the ability to process files uploaded using this field.

The image_field_widget_form extends the form created by file_field_widget_form and adds additional validation on the file extensions to ensure that the extension is something that is supported by the module. However by default the file_field offered by the file module allows any set of extensions to be configured in the field widget settings. Image module silently filters this list in image_field_widget_form (http://drupal.org/node/1014816#comment-5656548) and takes out extensions that are not supported by the module.

The currently supported extensions are ('png', 'gif', 'jpg', 'jpeg' - line 321, image.field.inc in image module) This means that TIFF which is not an extension supported by the module will be silently filtered out by image module causing a validation error during upload even when tiff is added as a valid extension in the field widget settings.

There is work going on (at the time of writing this article) to add support for different image types via plugins and this has already been added to Drupal 8 (http://drupal.org/node/1664844). So till tiff is supported by image module the extensions that can be uploaded will remain 'png', 'gif', 'jpg', 'jpeg'. You can patch image.field.inc to support more extensions but there will be problems while displaying these images.

Get Drupal updates straight to your inbox

To prevent automated spam submissions leave this field empty.

Post your comments / questions