PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Jul 20, 2019 10:30 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Mon Dec 27, 2004 6:15 am 
Offline
Forum Commoner

Joined: Tue Nov 09, 2004 9:32 am
Posts: 97
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 27, 2004 6:57 am 
Offline
Forum Contributor

Joined: Sun Dec 26, 2004 10:04 pm
Posts: 110
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 27, 2004 7:09 am 
Offline
Forum Commoner

Joined: Tue Nov 09, 2004 9:32 am
Posts: 97
sorry, do you have some code example?
s


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 27, 2004 7:17 am 
Offline
Forum Commoner

Joined: Tue Nov 09, 2004 9:32 am
Posts: 97
got it working, thanks for advice....


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 27, 2004 7:29 am 
Offline
Forum Contributor

Joined: Sun Dec 26, 2004 10:04 pm
Posts: 110
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);



?>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 27, 2004 7:54 am 
Offline
Forum Commoner

Joined: Tue Nov 09, 2004 9:32 am
Posts: 97


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 27, 2004 9:07 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 27, 2004 10:32 am 
Offline
Forum Contributor

Joined: Sun Dec 26, 2004 10:04 pm
Posts: 110


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group