Jump to content

Images on top of images


onlyican

Recommended Posts

I asked the other day, and did not get the responce I want.

Situation
I have 3 images, I want to "Merge" Them

Image1 = Background
Image2 = Top of building
Image3 = People from top

I want to add image 2 and 3 into image 1 using PHP (NOT CSS)

So say Image1 is 50px X 50px
Image2 and Image3 is 10x10px

I want to place Image 2 onto image 1 at pixle location 20 20
and Image 3 onto Image 1 at pixle Location 40,40

Any Ideas what function can be used

I dont want someone to say check php.net for the GD lib functions
I done that, none mention this, but I know one does this. Cant remember what one?

Thanks all in advance
Link to comment
https://forums.phpfreaks.com/topic/18334-images-on-top-of-images/
Share on other sites

Many Thanks

I think I got it

[code]

<?php
$flag = imagecreatefromjpeg('bground.jpg');
$mask = imagecreatefromjpeg('building.jpg');

imagealphablending($flag, 1);
imagealphablending($mask, 1);

imagecopy($flag, $mask, 10,10,0,0,25,43);

imagecopy($flag, $mask, 50,50,0,0,25,43);

imagecopy($flag, $mask, 150,50,0,0,25,43);

imagecopy($flag, $mask, 350,150,0,0,25,43);

imagecopy($flag, $mask, 450,450,0,0,25,43);

header("Content-type: image/jpeg");
imagejpeg($flag);
?>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.