I know that this is not a cakePHP specific question but I though
someone on here might have some experience with watermarking an image
with php/gd. I am attempting to overway a 24-bit PNG with transparency
over a set of images. The problem is that when I do this, the
transparency is discarded and I am left with a black box similar to
below:

http://www.theskateparkdirectory.com/img/imagecache/610458144f4809d2b1064b2c45ab.jpg

I've had success with this when using a 8-bit PNG but the edges of the
text are jagged and I would really like to be able to use a 24-bit
PNG.

I have pasted my code below. Thank you in advance for any help that
you can provide me with.

$targ_w = 600;
$targ_h = 450;

$jpeg_quality = 100;

$src = APP . WEBROOT_DIR . "/img/skateparks/_originals/" . $this->data
['Photo']['location'] . ".jpg";

$img_r = imagecreatefromjpeg($src);

$dst_r = ImageCreateTrueColor( $targ_w, $targ_h );

$watermark = imagecreatefrompng(APP . WEBROOT_DIR . "/img/
watermark.png");
imageAlphaBlending($watermark, false);
imageSaveAlpha($watermark, true);

imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,
$targ_h,$_POST['w'],$_POST['h']);

imagecopymerge($dst_r, $watermark, 460, 375, 0, 0, 150, 67, 100);

imagejpeg($dst_r,APP . WEBROOT_DIR . "/img/skateparks/" . $this->data
['Photo']['location'] . ".jpg", 100) ;




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to