dave wrote: > hello > > i'm working on a photo gallery for my site > which uses gd to resize pictures, this strips the exif metadata from the > image file > > my plan was to grab the exif data first (this was ok), then add it back > to the resized image (this was not ok) > > first, the images reverted back to their original state (or another > state of lower quality at the original full size) > > then i was thinking of trying to simply add the exif data, but since > there is no exif data, the appropriate tiff object cannot be retrieved > to be modified > > is there a simple workaround for this? > > or am i going about this wrong? > > my code is a part of a larger code base, so i'll just try to post > relevant, simplified code > > $jpeg = new PelJpeg(); > $jpeg->loadFile($fullFilePath); > > $exif = $jpeg->getSection(PelJpegMarker::APP1); > if (is_null($exif)) { > return null; > } > else { > $tiff = $exif->getTiff(); > $ifd0 = $tiff->getIfd(); > > $tmp = $ifd0->getSubIfds(); > // store all relevant fields (aperture, iso, shutter speed, etc.) > in an array/structure > > // resize and watermark image using gd (strips the exif metadata) > > // re-apply original exif metadata > > // and write back to the file > file_put_contents($fullFilePath, $jpeg->getBytes()); > } > > ideally what i need, is a way to add exif data to a new file (one that > has no exif data), is this possible? > > thanks > dave > > oops, can't believe i didn't see this earlier just get the exif data of the old file, load a new peljpeg with the new file and use insertSection to add the APP1 section to the new jpeg
easy :D -- http://dtracorp.com ------------------------------------------------------------------------- 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