Edit report at http://bugs.php.net/bug.php?id=54482&edit=1
ID: 54482
User updated by: info822 at freshsoftware dot net
Reported by: info822 at freshsoftware dot net
Summary: imagecreatefromstring fails
Status: Bogus
Type: Bug
Package: GD related
Operating System: Fedora 13 (Godard) Kernel Linux
PHP Version: 5.3.6
Assigned To: pajoye
Block user comment: N
Private report: N
New Comment:
I am closing this issue. Imagecreatefromstring does not handle large
images very well. I had to rewrite my code as shown above.
Previous Comments:
------------------------------------------------------------------------
[2011-04-11 23:25:25] info822 at freshsoftware dot net
$img_info = getimagesize("$calendar_info->event_img");
//Create a smaller image pallet
$thumb = imagecreatetruecolor($new_width, $new_height);// or die("Could
create true color image. Error on file: " . __FILE__ . " Line: " .
__LINE__);
// Output
if($img_info[2] == 1){
$source = imagecreatefromgif("$calendar_info->event_img");// or
die("Could create image from string. Error on file: " . __FILE__ . "
Line: " . __LINE__);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $new_width,
$new_height, $img_info[0], $img_info[1]);// or die("Could not copy image
Error on file: " . __FILE__ . " Line: " . __LINE__);
header("Content-Length: " . filesize("$calendar_info->event_img"));
header("Content-type: " . image_type_to_mime_type(IMAGETYPE_GIF));
imagegif($thumb);
}
elseif($img_info[2] == 2){
$source = imagecreatefromjpeg("$calendar_info->event_img");// or
die("Could create image from string. Error on file: " . __FILE__ . "
Line: " . __LINE__);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $new_width,
$new_height, $img_info[0], $img_info[1]);// or die("Could not copy image
Error on file: " . __FILE__ . " Line: " . __LINE__);
header("Content-Length: " . filesize("$calendar_info->event_img"));
header("Content-type: " . image_type_to_mime_type(IMAGETYPE_JPEG));
imagejpeg($thumb);
}
elseif($img_info[2] == 3){
$source = imagecreatefrompng("$calendar_info->event_img");// or
die("Could create image from string. Error on file: " . __FILE__ . "
Line: " . __LINE__);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $new_width,
$new_height, $img_info[0], $img_info[1]);// or die("Could not copy image
Error on file: " . __FILE__ . " Line: " . __LINE__);
header("Content-Length: " . filesize("$calendar_info->event_img"));
header("Content-type: " . image_type_to_mime_type(IMAGETYPE_PNG));
imagepng($thumb);
}
imagedestroy($thumb);
?>
------------------------------------------------------------------------
[2011-04-08 19:46:41] [email protected]
Totally unrelated issues.
------------------------------------------------------------------------
[2011-04-08 19:21:33] info822 at freshsoftware dot net
I am not the only person with that problem. Read:
http://www.zabbix.com/forum/showthread.php?t=11195
http://bugs.php.net/bug.php?id=29482
http://drupal.org/node/307028
------------------------------------------------------------------------
[2011-04-08 18:19:28] [email protected]
It is not PHP, it works just fine on any machine I tried.
------------------------------------------------------------------------
[2011-04-08 18:05:56] info822 at freshsoftware dot net
The code is outputing errors. Look at:
http://thewordsmith.dyndns.info/test/
Notice that a2.png is not created in:
http://thewordsmith.dyndns.info/link_to_tmp/
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=54482
--
Edit this bug report at http://bugs.php.net/bug.php?id=54482&edit=1