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
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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.