I am trying to output the date into my image, it works fine if I call it via <img src="date.php">, but when I try using <img src="<? $ben->header(); ?>"> it just spits out a load of garbled text!
ANy ideas!?
The code is below:
<?php
class ben {
function header() {
header("Content-type: image/png");
$string = date("l dS F Y");
$im = imagecreatefrompng("images/header.png");
$px = (imagesx($im) - 7 * strlen($string));
$color = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 3, $px, 60, $string, $color);
imagepng($im);
imagedestroy($im);
}
}
?>