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");

   }

}

?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to