Hi,
i'm using a small function found somewhere to watermark a JPG before
outputting to a website.
Since watermark change according to some other info, I can't create
watermark JPG before.
This is the function:
function watermark($sourcefile, $watermarkfile) {
//Get the resource ids of the pictures
$watermarkfile_id = imagecreatefrompng($watermarkfile);
imageAlphaBlending($watermarkfile_id, false);
imageSaveAlpha($watermarkfile_id, true);
$sourcefile_id = imagecreatefromjpeg($sourcefile);
//Get the sizes of both pix
$sourcefile_width=imageSX($sourcefile_id);
$sourcefile_height=imageSY($sourcefile_id);
$watermarkfile_width=imageSX($watermarkfile_id);
$watermarkfile_height=imageSY($watermarkfile_id);
$dest_x = 5;
$dest_y = 5;
imagecopy($sourcefile_id, $watermarkfile_id, $dest_x, $dest_y, 0,
0,$watermarkfile_width, $watermarkfile_height);
//Create a jpeg out of the modified picture
header("Content-type: image/jpg");
imagejpeg ($sourcefile_id,null,100);
imagedestroy($sourcefile_id);
imagedestroy($watermarkfile_id);
}
That would be perfect, if only imagecreatefromjpeg wouldn't remove the IPTC
tags in jpg!!
Does someone have a solution for this issue?
-fabio