dave <[EMAIL PROTECTED]> writes:

> well, it's a part of a larger base of code that i am working on, but
> basically, this is all i did
> // create the new PelJpeg object
> // load the local path of the jpeg to the object, this all happens
> after the file has been uploaded and moved to a permanent location

>             $origJpeg = new PelJpeg();
>             $origJpeg->loadFile($fullFilePath);
>
> // get the APP1 marker out, which will prolly contain the exif data
>             $exif = $origJpeg->getSection(PelJpegMarker::APP1);
>
> // now process the image, $imageResource is a php image resource,
> the image has been manipulated, eg. resized, watermarked, etc.
>             imagejpeg($imageResource, $fullFilePath, $maxQuality);
>
> // if the original file contains exif data, we want to add that data
> to the newly modified image
>             if (!is_null($exif)) {
> // the newly created image will probably have the exif data stripped
> by gd, so we add the exif taken from the original file into the new
> image
>                 $newJpeg = new PelJpeg();
>                 $newJpeg->loadFile($fullFilePath);
>
>                 $newJpeg->insertSection(PelJpegMarker::APP1, $exif, 1);
> // and then save the file again
>                 file_put_contents($fullFilePath, $newJpeg->getBytes());
>             }

Well, that looks very much like I would have expected :-)

Infact, I just wrote up a small example script that resizes image like
you suggest. It seems to work as expected on my test images.

-- 
Martin Geisler  ---  <[EMAIL PROTECTED]>  ---  http://mgeisler.net

Read, write, create Exif data in PHP with PEL:       http://pel.sf.net
Take control of your webserver with PHP Shell:  http://phpshell.sf.net

Attachment: pgpkO1bcVkf3C.pgp
Description: PGP signature

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
PEL-devel mailing list
PEL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pel-devel

Reply via email to