"Al Pro" <[EMAIL PROTECTED]> writes:

Hi,

Your message was stuck in moderation -- I have now configured the list
to allow your address to post. I've CCed this reply to you too, let us
know if you don't want that.

> I'm very new to OOP and PEL is really scares me.

Well, PEL is rather OO heavy... consider it a fun way to learn OO :-)

> I'm trying to read GPS data from photos, but I can't.
>
> I'm trying this:
>
> --------------------
> $file = "/home/re/gps1.jpg";
> $data = new PelDataWindow(file_get_contents($file));
>
> $jpeg = new PelJpeg();
> $jpeg->load($data);

In PEL 0.9.1 you can simply do

  $jpeg = new PelJpeg($file);

and then PEL will figure out to load the data from the file. It is
simply shorter than what you wrote, but does the same.

> $app1 = $jpeg->getExif();
> $tiff = $app1->getTiff();
>
> $ifd0 = $tiff->getIfd();
> $entry = $ifd0->getEntry(PelTag::GPS_LONGITUDE);
>
> print "Longitude: ".$entry;
> --------------------
>
> But I get nothing. What am I doing wrong?

The GPS data is not stored in the IFD0. So the getEntry() call returns
null. You need to do:

  $gps = $ifd0->getSubIfd(PelIfd::GPS);

and then your GPS_LONGITUDE entry should be in the $gps IFD.

If you think this is complicated, then I agree :-) PEL parses the
structure for you, but you still need to know where to find the right
bits of information. Using the dump-image.php file can help.

> Another question is how can I easy add Exiff data, even if JPEG file
> doesn't have any Exif data in it? Is there any PHP sample that shows
> how can I do it?

Please have a look at this URL in which a user explained how he added
data (including GPS!) to an empty JPEG file:

http://sf.net/tracker/?func=detail&atid=650323&aid=1815728&group_id=108380

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

Attachment: pgpvbDEkZGefE.pgp
Description: PGP signature

-------------------------------------------------------------------------
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