PHP Developers Network
http://forums.devnetwork.net/

Insert Gif in PNG using GD
http://forums.devnetwork.net/viewtopic.php?f=32&t=28897
Page 1 of 1

Author:  snicolas [ Mon Dec 27, 2004 6:15 am ]
Post subject:  Insert Gif in PNG using GD

Hey,

I am creating PNG file from text data.
This is working well.

Now I would like to insert an existing GIF image in my newly created PNG image.

Is this possible?

s

Author:  Robert Plank [ Mon Dec 27, 2004 6:57 am ]
Post subject: 

Yes, you can use ImageCreateFromGIF to create an image based on the GIF and then either put your text in that image, or use imagecopyresized() to copy one to the other, depends on what you want to do exactly. Go look those functions up on PHP.net.

Author:  snicolas [ Mon Dec 27, 2004 7:09 am ]
Post subject: 

sorry, do you have some code example?
s

Author:  snicolas [ Mon Dec 27, 2004 7:17 am ]
Post subject: 

got it working, thanks for advice....

Author:  Robert Plank [ Mon Dec 27, 2004 7:29 am ]
Post subject: 

Syntax: [ Download ] [ Hide ]
<?php



// Create image from GIF

$im = @imagecreatefromgif ("sample.gif");



// Write blue text on the top left corner

$color = imagecolorallocate($im, 0, 0, 255);

imagestring($im, 5, 0, 0, "1234567890abcdefhijklmnopqrstuvwxyz", $color);



// Output as PNG

header("Content-type:image/png");

imagepng($im);



// Clean-up

imagedestroy($im);



?>

Author:  snicolas [ Mon Dec 27, 2004 7:54 am ]
Post subject: 


Author:  feyd [ Mon Dec 27, 2004 9:07 am ]
Post subject: 


Author:  Robert Plank [ Mon Dec 27, 2004 10:32 am ]
Post subject: 


Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/