Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8933735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:37:11+00:00 2026-06-15T09:37:11+00:00

Is this possible to create a gif image with various text font,style,formats and alignment

  • 0

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
enter image description here

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

enter image description here

And the output gif image should look like
enter image description here

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:37:12+00:00Added an answer on June 15, 2026 at 9:37 am

    for this design:

    image

    You can use this code:

    <?php
    // Create a new image instance
    $img = imagecreatefrompng('back.png');
    
    // Draw a text string on the image
    //  imagestring ( resource $image , int $font , int $x , int $y , string $string , int $color )
    imagestring($img, 5, 20, 30, 'Heading1', 0x000000);
    imagestring($img, 3, 180, 30, 'Heading 2 test desc', 0x000000);
    
    imagestring($img, 3, 20, 80, 'Text info 3', 0xFF0000);   //red
    imagestring($img, 1, 180, 80, 'Demonstration text', 0x000000);
    
    imagestring($img, 5, 400, 170, 'Price here', 0xFF0000);   //red
    
    $im = imagecreatefrompng('plane.png'); //load pic 2
    imagecopymerge($img, $im, 0, 130, 0, 0, 165, 71, 70);
    imagedestroy($im);
    
    // Output the image to browser
    header('Content-Type: image/gif');
    imagegif($img);
    imagedestroy($img);
    ?>
    

    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 use imagettftext()-function.

    http://php.net/manual/en/function.imagettftext.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create gif/png image file using java programatically. This gif/png image should
Is this possible to create new {variable = x.something} and specify variable name dynamically?
This is just a question is it possible to create a hr tag in
It is possible to create a constant like this: http://haacked.com/archive/2007/09/16/conditional-compilation-constants-and-asp.net.aspx <%@ Page CompilerOptions=/d:QUUX %>
If it is not possible to create this list without loops, I'd be content
Is it possible to create a nested select statement something like this in mysql?
Is it practically possible to create a triangle of stars like this as below
In gcc it is possible to create an anonymous struct, like this: struct test2
This is the 'add new contact' window. Is it possible to create custom data
I fear this just may not be possible, but I'm trying to create a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.