Function or GD problem?

From: Date: Sun, 16 Mar 2003 22:55:22 +0000
Subject: Function or GD problem?
Groups: php.general 
Request: Send a blank email to php-general+get-139880@lists.php.net to get a copy of this message
Function or GD problem... I have a strange problem here, hoping someone can help. The following code works great but when I make it into a function it doesn't error but it gives a RED X image. PHP: <?php include("functions.inc.php"); $size = getimagesize("uploads/$src"); if ($size[2]==2) { $sourceimg = imagecreatefromjpeg("$full_img_url/$src") OR DIE("DIED"); if($size[0]<$size[1]) { if($size[1]<$height) { $height1=$size[1]; } else { $height1=$height; } $width1=($size[0]*$height1)/$size[1]; } else { if($size[0]<$width) { $width1=$size[0]; } else { $width1=$width; } $height1=($size[1]*$width1)/$size[0]; } Header("Content-type: image/jpeg"); $destimg = imagecreatetruecolor($width1,$height1) OR DIE("DIED"); //Try to resample (needs GD 2) if(imagecopyresampled($destimg, $sourceimg, 0,0,0,0, $width1, $height1, $size[0], $size[1])) { } elseif(imagecopyresized($destimg, $sourceimg, 0,0,0,0, $width1, $height1, $size[0], $size[1])) { } else { //HTML RESIZE } imagejpeg($destimg,'',76) OR DIE("DIED"); imagedestroy($destimg) OR DIE("DIED"); } } ?>

« previous php.general (#139880) next »