"nicolas touts" <[EMAIL PROTECTED]> writes: Hi Nicolas
I don't have so much time for PEL these days, so please send your PEL questions to the PEL devel list (subscribe first): https://lists.sourceforge.net/lists/listinfo/pel-devel Unfortunately the page complains about a Mailman bug at the moment, so you're excused... :-) I hope SF can fix it soon. > I'm a student in a french school, and i have to create a program in > order to manage EXIF data. > It was easy with the jpeg format but now i'm working on tiff files > and the script i'm using doesn't work. Okay -- I haven't tested TIFF images all that much... TIFF is only supported because the EXIF data happens to be stored in TIFF data. So it is likely that there could be bugs hidden here. > These are the lines i'm using, the tag XP_COMMENT is well fill but > the image is not more viewable.(it seems to delete image data) Uhh, that's bad! > I hope that you will help me with this problem. > Thank you very much! > > > require_once('PelDataWindow.php'); > require_once('PelJpeg.php'); > require_once('PelTiff.php'); > > $in="image.tif"; > > $title = 'Exif Info for '.addslashes(basename($in)); > $data = new PelDataWindow(file_get_contents($in)); > > if (PelJpeg::isValid($data)) { > > $jpeg = $file = new PelJpeg(); > echo $file; > $jpeg->load($data); > echo $jpeg; > $app1 = $jpeg->getSection(PelJpegMarker::APP1); > > if ($app1 == null) { > > $app1 = new PelExif(); > $jpeg->insertSection(PelJpegMarker::APP1, $app1, 2); > $tiff = new PelTiff(); > $app1->setTiff($tiff); > > } else { > $tiff = $app1->getTiff(); > } > > } elseif (PelTiff::isValid($data)) { > > $tiff = $file = new PelTiff(); > $tiff->load($data); > > > } else { > > echo "ERROR"; > > } > > $ifd0 = $tiff->getIfd(); > > if ($ifd0 == null) { > > $ifd0 = new PelIfd(); > $tiff->setIfd($ifd0); > > } > > $desc = $ifd0->getEntry(PelTag::XP_COMMENT); > > if ($desc == null) { > > $description = "NEW SET"; > $desc = new PelEntryAscii(PelTag::XP_COMMENT, $description); You must use the PelEntryWindowsString class for the XP tags. Other than that I cannot see anything wrong with the code. > $ifd0->addEntry($desc); > > } else { > > $entry_text = addslashes($desc->getValue()); > $description = "SET"; > $desc->setValue($description); > > } > > file_put_contents($in, $file->getBytes()); -- 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
pgpyPDn6fwUJc.pgp
Description: PGP signature
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ PEL-devel mailing list PEL-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pel-devel