Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add dynamic gif image to a png image

Status
Not open for further replies.

DavidPlus

Programmer
Feb 20, 2007
38
NL
Hi all. I have a png imaage and i want to add a dynamic image to it that is produced by calling an xml feed file.But i do not know how to achive that. I reached to point where i can add environmental varible to png but do now khow how to put dynamic image to it. I be happy if some one help me here.Thanks

Code:
<?php

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

$img_handle = imageCreateFromPNG("./currentimg2.png");

$color = ImageColorAllocate ($img_handle, 100, 100, 100);

$ip = $_SERVER['REMOTE_ADDR'];




ImageString ($img_handle, 3, 10, 9,  "Your IP: $ip", $color); 

ImagePng ($img_handle); 

ImageDestroy ($img_handle); 

?>

xml that has url of dynamic image .This xml is a feed:


- <playlist>
- <song>
<artist>Artisname1</artist>
<name>SongName1</name>
<image>./song_images/artistpic1.jpg</image>
<rating>3</rating>
<songid>2624</songid>
<totalvotes>35</totalvotes>
</song>
- <song>
<artist>Artistname2</artist>
<name>SongName2</name>
<image>./song_images/artistpic2.jpg</image>
<rating>3.5</rating>
<songid>4795</songid>
<totalvotes>14</totalvotes>
</song>

</playlist>
 
Ok, so I was very intrigued by this. Then I got confused, and then enlightened. I did a google search for "php png jpeg overlay" and found this really cool site!
I really like their idea. After looking at their source code (provided freely YAY!) I saw this line:
Code:
$im2 = imagecreatefromjpeg($image)
Which of course go its own Google search pointing me to one of this forums favorite places... php.net!

It then looks like he goes on to use imagecopy() which should also be at php.net

I didn't really throw any examples at you, but the manual pages and the open source script should be more than enough to get you back on track. Let us know if you have any other troubles.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top