Bugs item #3017880, was opened at 2010-06-18 04:28
Message generated for change (Comment added) made by lsolesen
You can respond by visiting: 

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)

        if ($exif == null) 
                $exif = new PelExif();
                $tiff = new PelTiff();
        $tiff = $exif->getTiff();
        $ifd0 = $tiff->getIfd();
        if ($ifd0 == null) 
                $ifd0 = new PelIfd(PelIfd::IFD0);

        $software_name = 'Example V2';
        $software = $ifd0->getEntry(PelTag::SOFTWARE);  

        if ($software == null) 
                $software = new PelEntryAscii(PelTag::SOFTWARE, $software_name);
                $resave_file = 1;
                echo 'null';
                $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 
                $success = 0;


>Comment By: Lars Olesen (lsolesen)
Date: 2010-07-21 15:40

Could you transform your code to a simpletest. That would make it easier to
help you. As I understand your code example, it seems that it is trying to
update the SOFTWARE. Could you attach an example image and the code you are
using to update the IMAGE_UNIQUE_ID. Could you also make the code as short
as possible, so only the error shows up?

Thank you in advance.


You can respond by visiting: 

This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
PEL-devel mailing list

Reply via email to