Jump to content


Photo

Images on top of images


  • Please log in to reply
2 replies to this topic

#1 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 22 August 2006 - 08:31 PM

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

Tell me the problem, I will try tell you the solution

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 22 August 2006 - 08:47 PM

http://www.php.net/imagecopymerge
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 22 August 2006 - 10:01 PM

Many Thanks

I think I got it


<?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);
?>


Tell me the problem, I will try tell you the solution




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users