GD library image problem

GD and GD2 are useful libraries for creating graphics on-the-fly. Discuss your PHP GD and GD2 scripts here.

Moderators: onion2k, General Moderators

Post Reply
Gerasimov
Forum Newbie
Posts: 1
Joined: Wed Mar 01, 2006 10:14 am

GD library image problem

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I think this belongs in phpgd.com's board. :)
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post 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.
Pierre.gd
Forum Newbie
Posts: 5
Joined: Wed Mar 15, 2006 9:23 am

Weak mode for imagecreatefromjpeg

Post 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
jonwondering
Forum Commoner
Posts: 39
Joined: Mon Mar 13, 2006 6:26 pm

Post 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-) ?
Post Reply