#25331 [Fbk->Opn]: imagecreatefromstring() makes an error with some strings
| From: | hgshoggins at yahoo dot fr | Date: | Sun, 31 Aug 2003 19:46:50 +0000 |
| Subject: | #25331 [Fbk->Opn]: imagecreatefromstring() makes an error with some strings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-46967@lists.php.net to get a copy of this message | ||
ID: 25331
User updated by: hgshoggins at yahoo dot fr
Reported By: hgshoggins at yahoo dot fr
-Status: Feedback
+Status: Open
Bug Type: GD related
Operating System: Linux web23.90.ha.ovh.net 2.4.20
PHP Version: 4.3.2
New Comment:
Thanks Alot!
I'll try to make them do this...
Hoggins
Previous Comments:
------------------------------------------------------------------------
[2003-08-31 13:03:54] 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 12:53:36] 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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25331&edit=1