Ok, I am really getting into creating images from php.
I want to make a script where by people can create their own 'designer wallpaper'.
Here is a simple script that will let you use fonts in your text.
Just add some fonts in the same DIR as this script.
Now link to ThisFile.php?text=SomeText&font=Somefont.ttf
But how do we add a picture into this script?
So that we can edit some picture.gif to make our wallpaper.
I want to make a script where by people can create their own 'designer wallpaper'.
Here is a simple script that will let you use fonts in your text.
Code:
<?php
Header("Content-type: image/gif");
if(!isset($s)) $s=11;
$size = imagettfbbox($s,0,"/$font",$text);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
$xpad=15;
$ypad=15;
$im =imagecreate($dx+$xpad,$dy+$ypad);
$blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF); //background
$black = ImageColorAllocate($im, 0,0,0);//outline
$white = ImageColorAllocate($im, 255,255,255); //text colour
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, "/$font", $text);
ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white, "/$font", $text);
ImageGif($im);
ImageDestroy($im);
?>
Now link to ThisFile.php?text=SomeText&font=Somefont.ttf
But how do we add a picture into this script?
So that we can edit some picture.gif to make our wallpaper.

Comment