Garrison Locke <[EMAIL PROTECTED]> writes:

> I can't seem to figure out how to add XP_TITLE and XP_COMMENT to
> images that already have some exif data. I'm able to edit the
> XP_TITLE and XP_COMMENT fields if they already exist in the image
> (because I moved them in PelIfd from EXIF to IFD1, but I can't add
> them to an image for some reason. It just comes out as question
> marks. I was hoping someone would be able to assist?
> The code I'm currently using is this, but it's obviously wrong :)
> $title = $ifd0->getEntry(PelTag::XP_TITLE);
> if ($title != null) {
>     // this part works just fine if the tag is already there.
>     $title->setValue($exifTitle);
> } else {
>     // this part doesn't work.
>     $newTitle = new PelEntryUndefined(PelTag::XP_TITLE, $exifTitle);

I believe the error is in the line above: the Windows fields must be
created with the PelEntryWindowsString class and not just
PelEntryUndefined. That should ensure that the string is encoded

Please note that this hasn't been tested much) at least not by me
since I don't use Windows).

>     $ifd0->addEntry($newTitle);
> }

Martin Geisler  ---  <[EMAIL PROTECTED]>  ---

Read, write, create Exif data in PHP with PEL:
Take control of your webserver with PHP Shell:

Attachment: pgpBDHEjhPxa9.pgp
Description: PGP signature

Take Surveys. Earn Cash. Influence the Future of IT
Join's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
PEL-devel mailing list

Reply via email to