php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25331 imagecreatefromstring() makes an error with some strings
Submitted: 2003-08-31 12:53 UTC Modified: 2003-08-31 16:56 UTC
From: hgshoggins at yahoo dot fr Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.2 OS: Linux web23.90.ha.ovh.net 2.4.20
Private report: No CVE-ID: None
 [2003-08-31 12:53 UTC] hgshoggins at yahoo dot fr
Description:
------------
hi,
using a mysql db, and jpeg images strings in BLOB fields. All the images are readable on a computer through any image editor. But imagecreatefromstring() doesn't recognize some of them as valid jpeg strings, (it returns the classic error message "not a valid image string") and I couldn't be able to find the commom criteria of these images.
The script is located on a server I do not own, and the admin says it's my script's fault. Some images work, and some not.
The problem appeared since they went up to GD2.
I'm only a PHP *USER*, so I do not use, and do not understand the compiling options, but I use the bundled gd2 library by uncommenting the line: "extension=php_gd2.dll". I test my scripts on a WinXP machine with Apache 2.0.45, and it perfectly works. I figured that, even if both my ISP and I are using GD2, it doesn't display the same way in phpinfo(): mine appears "bundled", and the ISP's doesn't.

So I think the imagecreatefromstring() function doesn't accept some strings any more, which the previous version did on my ISP' servers.

I hope that all the infos I provided will help you to solve the problem, which I'm sure doesn't come from me.


Reproduce code:
---------------
I just call a <img src="script.php?id=[the id of the image in my database]">


The script "script.php": (which normally contains the database connection infos, and the connection opening function)

$sql="SELECT * FROM image_db WHERE id='$img_id'";
$resultat=mysql_query($sql);

$quality=100;

$ligne=mysql_fetch_array($resultat);
$data=$ligne["data"];
$im=imagecreatefromstring($data);
$im=imagejpeg($im,"",$quality);
imageinterlace($im,$interlace);
imagedestroy($im);


Expected result:
----------------
I whish it simply displayed *all* the images. It does for some, and doesn't for some others wich are -I think I repeat myself- perfectly readable otherwise.

Actual result:
--------------
Well, in fact it doesn't, and also displays an HTTP 500 Internal Server Error.
I could get the error message only thanks to the admin, who tracked the error for me in a file.

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-31 13:03 UTC] derick@php.net
Your ISP should really use the bundled version which is much more stable then the external library. If it works for you with the bundled library, then it's not a problem with PHP most likely. So you'll have to ask them to recompile PHP and use the bundled GD library.

Derick
 [2003-08-31 14:46 UTC] hgshoggins at yahoo dot fr
Thanks Alot!
I'll try to make them do this...

Hoggins
 [2003-08-31 16:56 UTC] sniper@php.net
And ask them to report bugs like this as they are the only ones able to really TEST any suggestions we might have.
(if it works for you -> no bug anyway)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Aug 20 00:01:28 2024 UTC