The code I posted works fine in creating an image on the fly, where I can call imagegen.php from an html page.
background:In my web page the user will be asked to upload an image file for company logo or have the system create one for him. I will use the company name to create the logo image and point to it from the database. When a user do a search, he will get the information and the company logo based on the selection
The problem: I want to create the image using this script and save it to the web server hard drive and call the image from the html when I need it. In another word, how I can take the output of this script and save it to the hard drive inside of just displaying it as is now. hopefully it is clear.
the name of the script is imagegen.php
<php?
Header("Content-type: image/gif");
if(!isset($s)) $s=15;
if(!isset($text)) $text="Store Logo name";
$size = imagettfbbox($s,0,"/usr/home/v1/a0018851/html/fonts/times.ttf",$text);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
$xpad=9;
$ypad=9;
$im = imagecreate($dx+$xpad,$dy+$ypad);
$blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black);
ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white)
;
ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, "/usr/home/v1/a0018851/html/fonts/times.ttf", $text);
ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white, "/usr/home/v1/a0018851/html/fonts/times.ttf", $text);
Imagejpeg($im);
ImageDestroy($im);
?>