PDA

View Full Version : Text on Image


Erindesign
02-09-2008, 12:56 AM
Hey all, got through a ton of code for a user system script, and I'm stomped. I want the user's name to display on their profile picture.
text.gdf is a php text. andi.png is a real png image.

It Gives me: The image “http://site.com/profile.php” cannot be displayed, because it contains errors.

<?php
$imagedir="andi.png";
$font = imageloadfont('text.gdf');
$fontWidth = imagefontwidth($font);
$fontHeight = imagefontheight($font);
$text = 'HELLO WORLD!';
$fgColor = imagecolorallocate($imagedir, 0, 0, 255);
imagestring($imagedir, $font, 0, 0, $text, $fgColor);
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>

Thanx in Advance, Erind

Inigoesdr
02-09-2008, 01:52 AM
That usually means there is a PHP error that is in the image code, and if you comment out the header() function you should see the error.