I'm trying to place a logo into a white image and make it semi-transparent to be used as a watermark.
Here is my code...
// load the stamp and the photo to apply the watermark to
if (file_exists($logoPath)) {
$im = imagecreatefrompng($logoPath);
$size = getimagesize($logoPath);
$stamp = imagecreatetruecolor(612, 792);
imagefilledrectangle($stamp, 0, 0, 612-1, 792-1, 0xFFFFFF);
$sx = imagesx($stamp);
$sy = imagesy($stamp);
// center width and height
$centerX=$sx/2-$size[0]/2;
$centerY=$sy/2-$size[1]/2;
$res=imagecopymerge($stamp, $im, $centerX,$centerY, 0, 0, $sx, $sy, 15);
$waterPath = $watermark_path.$broker_id."_watermark.png";
// Save the image to file and free memory
imagepng($stamp, $waterPath);
imagedestroy($stamp);
imagedestroy($im);
}
It all looks good to me but when I run it I get this...
http://i43.tinypic.com/2cyft06.jpg
...as you can see, the lower right quad of the image is getting colored for some reason.