Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-557

Extension of images uploaded for a structured content are case sensitive

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.9.4
    • 2.9.3
    • None
    • None

      When an image with the name image.GIF is uploaded, the ImageResizer component test the following condition :

      if ("gif".equals(extension))
      {
        resizeGIFImage(data, newWidth, newHeight, os, smooth);
      }
      else
      {
        InputStream is = new ByteArrayInputStream(data);
        resizeJPGImage(is, newWidth, newHeight, os);
        is.close();
      }
      

      and fails miserably because a gif image can not be read like a JPEG:

      Caused by: com.sun.image.codec.jpeg.ImageFormatException: Not a JPEG file: starts with 0x47 0x49
      	at sun.awt.image.codec.JPEGImageDecoderImpl.readJPEGStream(Native Method)
      	at sun.awt.image.codec.JPEGImageDecoderImpl.decodeAsBufferedImage(JPEGImageDecoderImpl.java:210)
      	at org.ametys.anycontent.plugins.anycontent.htmleditor.ImageResizer.resizeJPGImage(ImageResizer.java:76)
      	at org.ametys.anycontent.plugins.anycontent.htmleditor.ImageResizer.resizeImage(ImageResizer.java:138)
      	at org.ametys.anycontent.plugins.structured.forms.binding.ImageBinding._resizeAndSave(ImageBinding.java:180)
      	at org.ametys.anycontent.plugins.structured.forms.binding.ImageBinding.doSave(ImageBinding.java:122)
      	at org.apache.cocoon.forms.binding.AbstractCustomBinding.saveFormToModel(AbstractCustomBinding.java:97)
      	... 93 more
      

            yabon Sébastien Launay (Inactive)
            yabon Sébastien Launay (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: