MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically.
I've just tried following this tutorial and it hasn't completely worked. At the moment I have the basic code with a few alterations for the font and what not, but all the page will display is the location of its self on my domain instead of an actual image. Ive found one weird thing though, if i comment out / delete the "ImageTTFText($image, 8, 0, 10, 17, $white, $font, $text);" line, it will crete an image as its supposed to, but without the text. Also, when i view the page in IE (with the code there) it shows an error about the "ImageTTFText". I have tried a few things including altering the case of some things and a few file paths for the font, but it doesn't seem to be working. Here is the current code: <?php Header ('Content-type: image/jpeg'); Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT'); Header('Pragma: no-cache'); $ip = $_SERVER['REMOTE_ADDR']; $text = "Your IP address is $ip!"; // set the dimensions $img_width = 240; $img_height = 100; // create the image $image = imagecreate($img_width, $img_height); // set the colours $cool = imagecolorallocate($image, 81, 86, 96); $black = imagecolorallocate($image, 0, 0, 0); $white = imagecolorallocate($image, 255, 255, 255); $red = imagecolorallocate($image, 255, 0, 0); $grey = imagecolorallocate($image, 204, 204, 204); $green = imagecolorallocate($image, 206, 129, 18); $blue = imagecolorallocate($image, 0, 0, 255); // set the background colour // number or is top left pixel x, top left pixel y, bottom right pixel x, bottom right pixel y imagefilledrectangle($image, 0, 0, $img_width, $img_height, $cool); // set the font and print text $font = '/usr/local/psa/home/vhosts/mydomain.co.uk/httpdocs/sig/ozhandin.ttf'; // now i will create a line with font size 8, with no angle, 10 pixels to the right, and 17 pixels down ImageTTFText($image, 8, 0, 10, 17, $white, $font, $text); // the above will display your IP address // output and destroy imagepng($image); imagedestroy($image); ?> EDIT: Okay problem solved!. It turns out that making the file path for the font to just ozhandin.ttf cured it. I realy thoguht i'd tried every possibility. Guess not, and sorry for reviving, maybe this could serve as a reminder to check through everything more than 10 times