Mantis - Quercus
Viewing Issue Advanced Details
3769 major always 11-17-09 10:56 11-19-09 03:22
damien  
 
normal  
new 4.0.2  
open  
none    
none  
0003769: Unable to read image data for some JPEGs, unable to generate valid GIFs
I've been experiencing some problems with PHP and scaling uploaded images. Some JPEG images cannot be identified by getimagesize (the JPEGs seem to be valid, but getimagesize does not return any information about the file), and it does not seem possible to generate GIF images using imagegif (I'm not sure if the problem stems from loading the source image using imagecreatefromgif), as the output file is always 0 bytes.
I'm using v4.0.1 on Mac OS X using Java 1.5. I've attached a simple web app that attempts to identify and scale three images (two JPEG, one GIF). I will try to test on Linux and Windows if I get the chance.

In my environment, I see the following output:

Details: images/budgerigar-100.jpg 1024x768 mime:image/jpeg size:158708
Details: images/budgerigar-100.small.jpg 200x150 mime:image/jpeg size:5674
Details: images/world-map.gif 800x519 mime:image/gif size:91878
Unable to get details for images/world-map.small.gif size:0
Unable to get details for images/drink.jpg size:37517

The example can be executed using 'mvn jetty:run' on the command line, and the results can be viewed at http://localhost:8080/. [^]
 image-test.tar [^] (327,680 bytes) 11-17-09 10:56
 world-map.gif [^] (91,878 bytes) 11-19-09 02:39
 drink.jpg [^] (37,517 bytes) 11-19-09 02:39
 world-map-ff.gif [^] (91,878 bytes) 11-19-09 03:12
 \\.host\Shared Folders\Downloads\world-map-ie.gif [^] (91,878 bytes) 11-19-09 03:17

Notes
(0004300)
damien   
11-17-09 11:02   
I should add that the scaled images from GIFs are OK when stored as JPEGs, but fail to save when stored as GIFs. I think this would indicate that the problem lies in the call of imagegif (which is responsible for generating the file).
(0004301)
damien   
11-18-09 06:40   
I've just tested under JDK1.6. This seems to fix the GIF problem, although one of the JPG files is still unreadable. The output is as follows:

Details: images/budgerigar-100.jpg 1024x768 mime:image/jpeg size:158708
Details: images/budgerigar-100.small.jpg 200x150 mime:image/jpeg size:7195
Details: images/world-map.gif 800x519 mime:image/gif size:91878
Details: images/world-map.small.gif 200x129 mime:image/gif size:9817
Unable to get details for images/drink.jpg size:37517
(0004303)
nam   
11-18-09 12:17   
thanks for the detailed report, can you attach one of the bad images to this bug report?
(0004305)
damien   
11-19-09 02:56   
I've uploaded two of the bad images. For the GIF image, Quercus is able to get the image information (using getimagesize), but is unable to save a scaled version of the image (this is in JDK1.5, it works correctly in JDK1.6, which I suspect may indicate that JDK1.5 doesn't support writing images in GIF format).

The getimagesize doesn't work for the JPEG image at all, although it does work for other JPEG images.
(0004306)
damien   
11-19-09 03:22   
Apologies, I've just checked the uploaded images in the tar file and the page, and neither are working! I had the same problem uploading compressed tar files on another bug report. Doing an xxd on the uploaded and downloaded files, it looks like the '?' characters (0x3f) are being substituted for some reason. I've tested uploading under Firefox, Safari and IE6, so I don't think it's a browser issue.