#25331 [NEW]: imagecreatefromstring() makes an error with some strings
| From: | hgshoggins at yahoo dot fr | Date: | Sun, 31 Aug 2003 17:53:36 +0000 |
| Subject: | #25331 [NEW]: imagecreatefromstring() makes an error with some strings | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-46964@lists.php.net to get a copy of this message | ||
From: hgshoggins at yahoo dot fr
Operating system: Linux web23.90.ha.ovh.net 2.4.20
PHP version: 4.3.2
PHP Bug Type: GD related
Bug description: imagecreatefromstring() makes an error with some strings
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.
--
Edit bug report at http://bugs.php.net/?id=25331&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25331&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25331&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25331&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25331&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25331&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25331&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25331&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25331&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25331&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25331&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25331&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25331&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25331&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25331&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25331&r=gnused