Hi all,
I have written a simple function that turns a string passed to the function into an image (for email address protection) only I want to be able to call it from other pages but when I do it just returns garbage (binary possibly?)
I cannot use header("Content-type: image/png"); because I have allready changed the headers becasue I use PHP includes to update page content?
Please anyone with any ideas?
Thanks, James
I have written a simple function that turns a string passed to the function into an image (for email address protection) only I want to be able to call it from other pages but when I do it just returns garbage (binary possibly?)
Code:
/**
* imageCreatex - this little function will
* turn any given string into an image.
*/
function imageCreatex($string){
//header("Content-type: image/png");
//*******MAKE IT SEND AN ERROR
$image = @imagecreate(110, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 233, 14, 91);
imagestring($image, 1, 5, 5, $string, $text_color);
imagepng($image);
return $image;
imagedestroy($image);
}
I cannot use header("Content-type: image/png"); because I have allready changed the headers becasue I use PHP includes to update page content?
Please anyone with any ideas?
Thanks, James