PDA

View Full Version : Error in writing in an image HELP!!!



jonsof
March 9th, 2003, 01:11
I want to write a string into an image through imagettftext() and some problems occur in execution

Here is my snippet



$string =" John Sofronis";
$length=strlen($string);
$width=600;
header("Content-type: image/jpeg");

$image = imagecreate($width,50);

$white = imagecolorallocate($image,255,255,255);

$black = imagecolorallocate($image,0,0,0);

$grey_shade = imagecolorallocate($image,204,204,204);

imagefill($image,0,0,$grey_shade);

imageRectangle($image,0,0,599,599,$black);

imagettftext($image, 10,0,10,33,$black,"Times.ttf",$string);

imagejpeg($image);


The images generated but it seems to be broken links Where is my fault. I have already copy into my folder the Times.ttf but nothing, could you help me?
i have already installed the GD 2.0 What might caused the error?

hohoho
March 9th, 2003, 01:30
you should use the absolute path to the Times.tff, and not the relative one

jonsof
March 9th, 2003, 01:42
I put C:\phpdev\www\output_program\image_generation\Times.ttf but it didn't work :(:(

What else can i do?