Link to home
Start Free TrialLog in
Avatar of Richard Korts
Richard KortsFlag for United States of America

asked on

Image Merge

See the sample site. I need to "merge" the two images so that the picture of the boy is overlyed with the frame, with the inner part of the frame transparent & the outer part overcovering the "edge" portions of the picture.

At the moment, the Pticture of the boy is a jpg & the frame is a transparent gif. I can make the frame a jpg.

Is there a way to do this using the php image functions, or, if not, using something else?
ASKER CERTIFIED SOLUTION
Avatar of steelseth12
steelseth12
Flag of Cyprus image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Richard Korts

ASKER

To steelseth12:

EXCELLENT! The only thing that didn't work from your php was: imagejpeg($image_resized);, that produces a bunch of gibberish characters in the browser. But no issue, I just saved it to a file & displayed the file in the browser.
Glad i could help.
For imagejpeg() to work correctly i would need no other data to be outputed to the browser .... so the browser sees the file as an image ..

Normally the way i do it is put all the image creation code in a file by itself and then give it as a source to the <img> tag

i.e

<img src='create_image.php'>
To steelseth12,

So there is another thing I perhaps did NOT address in the original question. I'll put it here, in case you can answer directly, but what I need is to be able to "blot out" all aspects of the original image that are OUTSIDE the overlay frame. Think of the overlay as a picture frame, we want the excess outside the frame cut off. I can of course make the outside black or a light gray or ?? but any color other than white will look strange.

If you want I will start a new question & you can look for it. I'll put it in the same categories, etc.

Let me know.

Thanks,

rkorts
Why not make the outsite of the border white
e.g https://filedb.experts-exchange.com/incoming/ee-stuff/5564-imgoverlay.gif
There are ways to calculate it in php but it requires alot of work and it will put unnecessary strain on the server.
To steelseth12,

I got the image, thanks. But the inside is now black. Don't I have to change something in the php code?

Thanks,

rkorts
Black ? No you shouldnt have to change anything ... it displays fine on my local host.

Thats strange ... try it with a png https://filedb.experts-exchange.com/incoming/ee-stuff/5565-imgoverlay.png

change

$overlay = imagecreatefromgif("imgoverlay.gif");
to
$overlay = imagecreatefrompng("imgoverlay.png");