Code: Select all
<?php
function image($sizeinp,$text,$textdb,$font)
{
$size = imagettfbbox($sizeinp, 0, $font, $text);
$xsize = abs($size[0]) + abs($size[2]);
$ysize = abs($size[5]) + abs($size[1]);
$image = imagecreatefromjpeg("textimage.jpg");
$imagesize = getimagesize("textimage.jpg");
$textleftpos = round(($imagesize[0] - $xsize) / 2);
$texttoppos = round(($imagesize[1] + $ysize) / 2);
$white = ImageColorAllocate($image, 229,232,213);
chmod("textimage.jpg",0777);
imagettftext($image, $sizeinp, 0, $textleftpos, $texttoppos, $white, $font, $text);
imagejpeg($image,"image/$textdb".".jpg");
}
?>calling the function:
Code: Select all
<?php
image('31',$cat_Name,$catdb,'alsscrp.ttf');
?>