imagecreatefromjpeg drops IPTC data

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

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

     $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);


That would be perfect, if only imagecreatefromjpeg wouldn't remove the IPTC
tags in jpg!!
Does someone have a solution for this issue?


Site Timeline