Bugs item #3017880, was opened at 2010-06-18 00:28
Message generated for change (Tracker Item Submitted) made by fnplus
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=650322&aid=3017880&group_id=108380
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parsing
Group: PEL Version 0.9.x
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Fred N (fnplus)
Assigned to: Nobody/Anonymous (nobody)
Summary: getEntry(PelTag::IMAGE_UNIQUE_ID) always returns null
Initial Comment:
I clear the Exif data of a jpeg and then add a new entry and this process works
properly, except with the PelTag of IMAGE_UNIQUE_ID. Once an image has been
processed with it, it should now have a new entry for SOFTWARE, for example, so
if I run the script again on the image that was just processed, instead of
$software returning null, it will return a value, which means it only needs to
be updated using $software->setValue($software_name), see the else condition
below. That works for SOFTWARE and likely all the others. However,
IMAGE_UNIQUE_ID always returns null in this process, even though it has been
set the first time around. I verify that it has been set using three different
Exif readers and they all show the content is there. So, if I pass the image
that was just processed through the script again, it should not equal null and
be sent to the else condition for updating the value. Instead, however, it is
always null. This should not be happening.
@include_once $_SERVER['PHP_INCLUDE'].'/3rdparty/pel/PelJpeg.php';
$success = 1; // return true by default, as this function may not
resave the file, but it's still success
$resave_file = 0;
$jpeg = new PelJpeg($filename);
// should all exif data on photo be cleared (gd and iu will always
strip it anyway, so only
// force strip if you know the image you're branding is an original)
$jpeg->clearExif();
if ($exif == null)
{
$exif = new PelExif();
$jpeg->setExif($exif);
$tiff = new PelTiff();
$exif->setTiff($tiff);
}
$tiff = $exif->getTiff();
$ifd0 = $tiff->getIfd();
if ($ifd0 == null)
{
$ifd0 = new PelIfd(PelIfd::IFD0);
$tiff->setIfd($ifd0);
}
$software_name = 'Example V2';
$software = $ifd0->getEntry(PelTag::SOFTWARE);
if ($software == null)
{
$software = new PelEntryAscii(PelTag::SOFTWARE, $software_name);
$ifd0->addEntry($software);
$resave_file = 1;
echo 'null';
}
else
{
$software->setValue($software_name);
$resave_file = 1;
echo 'update';
}
if ($resave_file == 1
&& !file_put_contents($filename, $jpeg->getBytes()))
{
// if it was okay to resave the file, but it did not save
correctly
$success = 0;
}
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=650322&aid=3017880&group_id=108380
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
PEL-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pel-devel