Md. Golam Rabbany

Just work with honesty, Success will come on your door

Monthly Archives: April 2010

Adding Custom Text to an Image


<?
header ("Content-type: image/pjpeg");
$string = "This is sooo cool it works!!!";
$font  = 4;
$width  = ImageFontWidth($font)* strlen($string) ;
$height = ImageFontHeight($font) ;

$im = ImageCreateFromjpeg(“./PLACE_IMAGE_NAME_HERE.jpg”);
$x=imagesx($im)-$width ;
$y=imagesy($im)-$height;
$background_color = imagecolorallocate ($im, 255, 255, 255); //white background
$text_color = imagecolorallocate ($im, 0, 0,0);//black text
imagestring ($im, $font, $x, $y,  $string, $text_color);

imagejpeg ($im);
?>