Forum Moderators: coopster

Message Too Old, No Replies

Merging 2 images

transparent front on solid background

         

mcibor

8:02 pm on Sep 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have two pictures the same size: background.gif and front.gif 60x60.

What I would like to do is to merge the images. The front.gif is a person on transparent layer. The background is solid.

How can I show the person on the background using php? What kind of adds do I need to have?
I have no idea how to operate the images with php, so any help (or tutorial) or example is really appreaciated.

Thanks
Michal Cibor

StupidScript

11:49 pm on Sep 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried using CSS to do it? Put the background image in one positioned DIV and the foreground image in a second identically-positioned DIV with a higher z-index value. The background image will show through the transparent portions of the foreground image.

Or are you inquiring about using the PHP graphics libraries to create a third image combining the two?

dcrombie

3:23 pm on Sep 21, 2005 (gmt 0)



Otherwise look at using ImageMagick [imagemagick.org] and the composite [imagemagick.org] command (called from PHP using system [php.net]).

Good luck ;)

mcibor

8:12 pm on Sep 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It doesn't matter for me how to do it. I want it just displayed.

So StupidScript, could you post here the sample code how it's supposed to look like?

Thanks for the fast answer!

As for composite it would suffice, however I don't have such access to the server as to install something, and sadly the mod is not installed. So I think the StupidScript method will have to do. But thanks for answer!

Best regards
Michal Cibor