Forum Moderators: coopster
<?php
// set up image
$height = 600;
$width = 656;
$im = ImageCreateTrueColor($width, $height);
$white = ImageColorAllocate ($im, 255, 255, 255);
$blue = ImageColorAllocate ($im, 0, 0, 64);
// draw on image
ImageFill($im, 0, 0, $white);
ImageLine($im, 328, 40, 328,$height, $blue);
ImageString($im, 4, 50, 153, 'Tom\'s first birthday', $blue);
ImageString($im, 4, 260, 10, 'Date of birth 1978', $blue);
ImageString($im, 4, 50, 133, '14/06/1979', $blue);
ImageLine($im, 50, 150, 328,150, $blue);
//watermark image dimensions are width 200, height 91
$watermark = ImageCreateFromPNG("watermark.png");
($im,$watermark,100,100,200,91,200,91,100);
// output image
Header ('Content-type: image/png');
ImagePng ($im);
ImageDestroy($im);
ImageDestroy($watermark);
?>
bool imagecopymerge [php.net] ( resource dst_im, resource src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct )
Your problem is that you don't have the x and y coordinates of the source set correctly. Try this:
//watermark image dimensions are width 200, height 91
$watermark = ImageCreateFromPNG("watermark.png");
imagecopymerge($im,$watermark,100,100,0,0,200,91,100);
That last parameter is the transparency, if you play with that now I think you will see you can make your watermark ... well, more transparent.