----- Original Message ----- 
From: "Wade Smart"
> Going through the forums on several sites Im not the only one having 
> this problem. And its still confusing as some say that the second 
> parameter is a file name and some say its a destination. And it seems to 
> work either way for many - which I dont understand that at all.
> 
> I simplified this out to just:
> $saveTo = "new_picts/"
> $saveAs = "NewFile.png"
> 
> and tried
> imagepng($img_handle, $saveTo) and imagepng($img_handle. $saveAs);
> and neither work. Adding in the third and four parmeter as several posts 
> say you must have, I added 0, NULL but that didnt help either.
> 
> As for right now, only imagepng($img_handle); seems to work.


Hi Wade,
James example worked just fine.

<?php
header('Content-type: image/png');
$img = imagecreatefrompng('hotlink.png');
$col = imagecolorallocate($img, 0, 0, 0);
imagestring($img, 5, 4, 1, "circlecity.co.uk", $col);
imagepng($img);
imagedestroy($img);
?>

The image handle is all that's needed in imagepng();
It's the imagestring($img, $fontsize, $xpos, $ypos, $textstring, $col); that 
you would put your text variables in.

You'll want to use your own font, as the max size is 5 in the default text 
font, which is fairly small.

Once you get it working, you can add some variables to be passed to it, as the 
text may overlap certain things in the images. Left, center, right, upper, 
lower (you have to calculate them yourself) and maybe different light and dark 
colours.

You can use getimagesize($img); to get the mime type and $attr is really handy.
It's all in the downloadable PHP manual.

As mentioned previously, you'd need to check if the image exists.
Bob.


Reply via email to