This is something really interesting, to generate a logo automatically using php. Its quite simple and easy to do. Anyway Have a look at the code
if (!(file_exists("logophilip.png"))) // Checks file exist or not
{
$imgvalue = "Philip Tiju Abraham"; // Assign some text for the logo
$font_file = 'aladdin.ttf'; // Desired font, Make sure u have it in the same folder
$pic=ImageCreate(500,70); // Define the size of the image a x b
$col1=ImageColorAllocate($pic,230,197,156); // Background
$col2=ImageColorAllocate($pic,255,0,0); // Fontcolor
ImageFilledRectangle($pic,1,1,100,100,$col1);
ImageFtText($pic, 40, 0, 0, 50, $col2, $font_file, $imgvalue);
ImagePNG($pic,"logophilip.png"); // Thats it done...
ImageDestroy($pic);
}
Initially it checks the file exist or not, If the file already exist, its not necessary that we need to create again. Assign $imgvalue with the some test, here its "Philip Tiju Abraham". Also do select some font-face. Make sure you have the font in the same folder. $pic defines the size of the image. $col represents background color and $col2 represents font color. ImageFilledRectangle(), ImageFtText(), ImagePNG(), ImageDestroy() are function which renders the image.
Now to display the image is so simple...
