Hey everyone how are you all doing?
I am trying to use the imagerotate GD function to place an image on top of another image at an angle. Obviously when it rotates an image it creates a rectangular image big enough to fit the angled image inside with the background colour of this defined in the third arg of imagerotate. The problem i'm having is i want to make this background colour transparent so when i copy it on top of my existing big image the image appears properly at an angle and this background doesn't cover up the pictures it's being placed on.
I have the following code:
$u2 = imagecreatefromgif($user2);
$rotate = imagerotate($u2, -5, 7);
//$rotatecol=imagecolorallocate($rotate, 0, 0, 0);
//imagecolortransparent($rotate, 7);
//imagealphablending($rotate, true);
//imagesavealpha($rotate, true);
$rwidth=imagesx($rotate);
$rheight=imagesy($rotate);
imagecopymerge($im1,$rotate,273,71,0,0,$rwidth,$rh eight,100);
imagejpeg($im1,$filepath,100);
This all works perfectly, except it uses (in this case) grey (from the final value in imagerotate) as the background to the rotated image and then you can see the grey backing on the final image. I cannot for the life of me work out how to set this as transparent instead of grey, both u2 and im1 are truecolor images and i tried using a combination of imagecolortransparent/ imagealphablending/ imagesavealpha as you can see above, but to no avail.
I would so appreciate any pointers anyone could give me as to how to make this work, as it's driving me crazy and i know i'm not really understanding the logic of it, which i think is why ican't work out how to do it, no matter how much of the manual i read!!!
Thanks so much everyone,
Dave