I noticed the following strange behaviour. WideImage will not resize a vertical large JPG image. I tried to resize a 2000x3008 2.62Mb (2.748.084 bytes) jpeg image with the following code:
$image = WideImage::load("DSC.JPG");
$resized = $image->resize(300, 200, 'inside', 'down');
This code works perfectly with a landscape image of the same resolution (3008x2000) but it will not work with a portrait image (2000x3008).
To be really sure about this issue a rotated the SAME image from vertical to horizontal and it did work. When the above code is executed on the vertical image it ends / exits without any warning. I simply does nothing. It exits immediately.
On the other hand when the same image is rotated to horizontal the code does resize the image correctly. I also tried the following strings:
$resized = $image->resize(300, 300, 'inside');
$resized = $image->resize('50%');
I noticed that if I resize the vertical image with an other software as Fastone or ACDSee to 1000x1504 (50%) before letting WideImage manipulate it, WideImage will work properly.
My first thought was it must be a memory issue, but the horizontal image most likely uses the same amount of memory, so this probably isn't it. I'll try to reproduce this issue and find out what the problem is. There must be something with the image dimensions or some GD bug. I'll keep you posted.
I've tried to replicate the issue, but didn't succeed. Can you please send me more info:
- which PHP version are you using?
- what is the GD extension version?
- how much memory do you have available in php.ini (memory_limit)
Also, can you edit the file Mapper/JPEG.php in WideImage lib directory, and remove the "@" character from the call to imagecreatefromjpeg() in load($uri) method? This will stop suppressing possible errors in call to GD. And can you add some debug output, so we can be sure that the correct code is executed and whether it fails when loading? Something like this:
echo "JPEG load called\n";
$result = imagecreatefromjpeg($uri);
echo "imagecreate called\n";
And let me know of the result. I'm quite confident this is some GD bug or distro issue, because it works on 3 different versions that I have available.
Yes, you are right. It must be a distro issue as I noticed this bug when I was working locally with Uniform Server Nano. When I uploaded the same code to my web server it worked correctly. I did not mention before Uniform Server as it has always worked fine and I did not supposed it could be its fault.
By the way Uniform Server PHP version is 5.3.3, GD version is 2.0.34, memory-limit is 32M; web server PHP version is 5.2.13, GD version is 2.0.34, memory-limit is 128M.
If you wish to test the issue, I made a ZIP file with the Uniform Server Nano, the two pictures I was working with and my PHP code. You may download the package here
You will find the PHP code in www/uploader/index.php and the pictures in www/uploads/.
P. S. During my tests I did change the Mapper/JPEG.php as you said but I never had any output
Best regards and many thanks for your excellent WideImage library.
I'm having this exact same problem, were you ever able to get this resolved?