OK, here is the modified code, I am not getting any errors, but the file is still not generating with the logo on top of
it.
<?
$id = ImageCreateFromPNG("images/rsc_flyer1.png");
$black = ImageColorAllocate($id, 0, 0, 0);
$red = ImageColorAllocate($id, 208, 52, 71);
$font = 'arial';
$filename= sprintf("%s_flyer.png", $flyername);
Imagettftext($id, 18, 0, 32, 192, $red, $font, $headline);
Imagettftext($id, 13, 0, 32, 210, $black, $font, $subhead);
Imagettftext($id, 11, 0, 38, 535, $black, $font, $bodycopy);
ImagePNG($id,"createdimages/$filename");
function watermark($src, $newname, $watermark, $quality) {
$imageInfo = getimagesize($src);
$width = $imageInfo[0];
$height = $imageInfo[1];
$logowidth = $logoinfo[0];
$logoheight = $logoinfo[1];
$horizextra =$width - $logowidth;
$vertextra =$height - $logoheight;
$horizmargin = round($horizextra / 2);
$vertmargin = round($vertextra / 2);
$photoImage = ImageCreateFromPNG($src);
ImageAlphaBlending($photoImage, true);
//ImagePNG($photoImage); // output to browser
ImagePNG($photoImage, $newname, $quality);
}
//$src should be the source file
$src = "createdimages/$filename";
//$newname should be the desired output file
$newname = $src;
//$watermark should be the image to be overlayed
$watermark = "images/logo.png";
//run the function :: 4th parameter is quality
watermark($src, $newname, $watermark, 100);
?>