Hi
I need to make a image with gd lib. My problem is that I need to make a base size image and add 2 layers to that image. The images has to preserve transparent or the last added layer has to, because its the template.
Here is my code. When adding the second layer its not transparent.
CODE
-----------------------
//Image behind watermark
$pic2 = '../uploads/products/[login to view URL]';
$img2=imagecreatefromjpeg($pic2);
$img2_width=imagesx($img2);
$img2_height=imagesy($img2);
//Watermark
$watermark="../gfx/". $_GET['watermark'];
$watermark=imagecreatefrompng($watermark);
$watermark_width=imagesx($watermark);
$watermark_height=imagesy($watermark);
$final_image = imagecreatetruecolor($watermark_width, $watermark_height);
$white = imagecolorallocatealpha($final_image, 255, 255, 255, 127);
imagefill($final_image, 0, 0, $white);
imagealphablending($final_image, true);
// First image to add to the transparent area layer $final_image are on a given location works fine
imagecopymerge($final_image, $img2, 20, 20, 0, 0, $img2_width , $img2_height, 100);
//This one becomes not trasparent as its the second layer on the $final_image. Please Help ??? HELP HERE
//imagecopymerge($final_image, $watermark, 0, 0, 0, 0, $watermark_width , $watermark_height, 100);
imagealphablending($final_image, false);
imagesavealpha($final_image, true);
// output the result to browser
header ("Content-type: image/jpg");
imagejpeg($final_image, '../uploads/products/designer/thumbs/test-'.$_GET['pic'], 100);