Thanks for your reply. I forgot to check back, because i found a solution to my 
problem. First, I use windows because this is a work thing - I would prefer 
good old linux.
there were a few things wrong in PEL when it comes to these windows-strings, 
which I seemingly fixed - but cant remember what or where. the problem was that 
those 5 strings were not in the block PEL thought, they were in block EXIF but 
need to be in block IFD0 (or the other way around). Well if someone is 
interested in making a patch or so, drop me a line an ill send you my changed 
version of PEL. wasn't anything big that kept it from working.
MfG
        Jonas Beck

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Martin Geisler
Gesendet: Freitag, 5. Oktober 2007 22:10
An: Discussions on the development of PEL
Betreff: Re: new PelEntryWindowsString entries wont show up again.

"Beck, Jonas" <[EMAIL PROTECTED]> writes:

Hi Jonas

> i have to convert about 40000 pictures using a php skript - part of
> that conversion is the addition/modification of the EXIF data of all
> that images. PEL seemed perfect for the job, especially as the JPEG
> MetadataToolkit is not able to create new EXIF data so easily.

Wow, that is a lot of photos! I'm glad to hear that PEL is being
pushed to its limits.

> If an image has no EXIF data yet I want to add some - to some extend
> that works as expected, but if I try to add those winXP EXIF tags,
> PEL wont read them. They are written to the header - as I can view
> them with the JPEG MetadataToolkit, but windows wont show them. If I
> write them in with windows, PEL wont show them.
>
> if use:
>
> $title = $ifd0->getEntry(PelTag::XP_TITLE);
>
> echo $title;
>
> if ($title == null) {
>   echo "Adding new XP_TITLE entry with value 'XP_TITLE'.<br>";
>   $title = new PelEntryWindowsString(PelTag::XP_TITLE, "CATDog");
>   $ifd0->addEntry($title);
> } else {
>   echo "Updating XP_TITLE entry from '".$title->getValue()."' to 
> 'XP_TITLE'<br>";
>   $title->setValue("XP_TITLE");
> }
>
> to check for an XP_TITLE, and create one if there isnt any.

That should be the correct way to do it.

> But there is never an XP_TITLE tag - even if windows shows it and I
> can read it in the EXIF data. PEL just wont get it.

Okay... As I don't use Windows, these XP_* tags have been only very
lightly tested. And I have seen no reference on their format, all I
know is that the test image I got used a format like this for your
example of "CATDog":

  'C' 0x00 'A' 0x00 'T' 0x00 'D' 0x00 'o' 0x00 'g'

So PEL simply loads data from these tags by skipping over NULL bytes
and saves it again with a NULL byte between each byte of text. You can
find the code in PelEntryByte.php line 238 and PelIfd.php line 404.

> if I do a
>
> $tags = $ifd0->getEntries();
>
> foreach($tags as $nr=>$tag) echo "$nr ".$tag->getValue()."<br>";
>
> directly after the above code - the XP_TITLE tag is found.

This is because the data is kept in the PelEntryWindowsString object
just created. The data is kept in decoded form (as "CATDog").

> if I have PEL save the data, load it again, and then run the lines
> above again, the XP_TITLE tag isnt found anymore (but there).

That sounds like a bug.

> this only happens for tags I create with 
>
> new PelEntryByte(PelTag::PEL_TAG, "string"); 
>
> my
>
> $desc = new PelEntryAscii(PelTag::IMAGE_DESCRIPTION, $description);
>
> is saved and found after that just like it should.

That is also tested much more, both by users and by the unit tests.

> anybody got an idea of how to fix this - or is it me being stupid?

I don't know a fix for this, and unfortunately I don't have time to
debug this now.

For debugging I suggest you use a hex editor (I've used ghex) and lots
of print statements. Try inserting a tag using WinXP, and dump it with
debug output (dump-image.php -d or Pel::setDebug(true)). That gives
you some information about the offsets found by PEL, maybe you can
learn something from this.

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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
PEL-devel mailing list
PEL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pel-devel

Reply via email to