Forum Moderators: coopster

Message Too Old, No Replies

Cannot save created img

using a few GD ()

         

henry0

8:18 pm on Mar 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I try to save the result of an img created and written on.
(actually I verified that the browser renders required written img but I cannot save it and copy it)
Furhter I do not get any error from if(!copy....

I know I surely miss the obvious but GD is not by far my forte!

$string = "AAAA";

$im = imagecreatefromjpeg("../default/a.jpg");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
$b=imagejpeg($im);

$src=$b;
$dest="../default/$b.'b.jpg' ";

copy($src, $dest);
if(!copy($src, $dest))
{echo"no";}

imagedestroy($im);

cameraman

8:25 pm on Mar 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



bool imagejpeg [us3.php.net] ( resource $image [, string $filename [, int $quality ]] )

You're trying to copy a boolean return value.
Use the same function to save to a file (with the optional filename parameter) or send to the browser.

henry0

9:06 pm on Mar 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Indeed! done thanks