Is this possible to create a gif image with various text font,style,formats and alignment having background image in php?
For example I have a background image like

And an image which I want to insert on background image is

And the output gif image should look like

I tried the code for this
<?php
// Create a new image instance
$im = imagecreatetruecolor(300, 250);
$img = imagecreatefrompng('back.png');
// Make the background white
imagefilledrectangle($im, 0, 0, 300, 250, 0xEFEFEF);
// Draw a text string on the image
imagestring($im, 20,20, 40, 'Heading1', 0x000000);
imagecopymerge($img, $im, 0, 0, 0, 0, 300, 250, 70);
// Output the image to browser
header('Content-Type: image/gif');
imagegif($img,'test.gif');
imagedestroy($im);
?>
But unfortunately it doesn’t give the output as desired and I want to add more content to the background image as I shown in output image.
for this design:
You can use this code:
The
imagestring()function is limited to a built in, rather ugly font, and with size option of only 1 to 5. You can use another function for TTF fonts instead as described below.To change the font you need to provide your own TTF format fonts, place them in the same folder as the script and replace the
imagestring()function to this one instead. The parameters is very similar and it should be trivial for you to replace that code yourself. Here’s the link explaining how to useimagettftext()-function.http://php.net/manual/en/function.imagettftext.php