Page 1 of 1

GD library image problem

Posted: Thu Mar 02, 2006 1:53 am
by Gerasimov
First I want to apologize for my terrible English:) and here is my question:

I just finished a script with different manipulations and resizing of images. For this project I am using GD lirbrary. The script is working just fine, but there is a little problem. Most of the images are passing with no problems at all, but in few cases the image failed. I checked the images for errors with some script for checking jpeg and png images and it appeared that the images are corrupt. The confusing part is that the pitures are looking perfectly fine and they may be open in every application for manipulation of images and image viewers. Even from the Apache server and any kind of browser.
Did anyone encounter such problem, and have any idea what is the problem in this case.

Posted: Thu Mar 02, 2006 2:13 am
by feyd
I think this belongs in phpgd.com's board. :)

Posted: Thu Mar 02, 2006 4:58 am
by onion2k
There are a few image variations that GD can't handle. GD is very strict about things like that. For example, CMYK encoded Jpegs were only added very recently, some jpegs from mobile phone cameras add headers GD doesn't like, some slightly corrupted jpegs will open in Photoshop but not with GD .. it's annoying but there's no way around it. You just have to make sure your error checks are in place.

Weak mode for imagecreatefromjpeg

Posted: Wed Mar 15, 2006 9:46 am
by Pierre.gd
In the next version of PHP 5.1 (5.1.3), you will have an ini setting to be able to load corrupted JPEG:

gd.jpeg_ignore_warning

You can set it to true in your script using ini_set, by default it is set to false.

You can try it already using the php 5.1.3RC1 available here:

http://downloads.php.net/ilia/php-5.1.3RC1.tar.bz2

or using snaps.php.net

Posted: Sat Mar 25, 2006 1:46 pm
by jonwondering
What if the version of PHP is 5.1.2 - is there a way to set the value to 1?

Is there any way to allow corrupted JPEG to be uploaded (for those of us stuck with 5.1.2-) ?