CodeIgniter Forums
Photo Geodata? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Photo Geodata? (/showthread.php?tid=52882)



Photo Geodata? - El Forum - 06-30-2012

[eluser]retypejonas[/eluser]
Hello Igniters,

I am a Code Igniter newbie playing around with the file upload and image manipulation classes.

One thing i wonder is, if i want to get the exif geodata from an image, what would be my best option? As far as i can see there is no method built in by default?

I am mainly interested in X and Y coordinates. I guess they are in the file somewhere, but have no idea how to fetch them.

Thank you in advance!


Photo Geodata? - El Forum - 06-30-2012

[eluser]CroNiX[/eluser]
I don't think CI does anything with exif specific data. The reason probably being is that it requires the php_exif module, which not all servers have installed.

So, you'll have to roll your own solution on this one. PHP does have ways to read exif data, but you need the module installed as I mentioned. Google will be your friend here "php exif gps"


Photo Geodata? - El Forum - 06-30-2012

[eluser]retypejonas[/eluser]
Thank you, that was what i thought. Was hoping there was a more or less complete class laying around somewhere that i hadn't found yet Smile


Photo Geodata? - El Forum - 06-30-2012

[eluser]CroNiX[/eluser]
There very well could be, and if not, it would be nice for you to release yours when you're finished Smile

I'm sure there are tons of ready made php functions/classes to handle this and it would literally take a few minutes to make it work in CI, or it could be as easy as a single function that gets saved as a helper that CI can then load and use.


Photo Geodata? - El Forum - 06-30-2012

[eluser]CroNiX[/eluser]
In fact, here's one from the Nokia Developers site:
http://www.developer.nokia.com/Community/Wiki/Extract_GPS_coordinates_from_digital_camera_images_using_PHP


Photo Geodata? - El Forum - 07-01-2012

[eluser]retypejonas[/eluser]
If anyone finds this thread, this is how i solved it.

Found this example

http://www.quietless.com/kitchen/extract-exif-data-using-php-to-display-gps-tagged-images-in-google-maps/

And did some minor edits to suit my needs,

https://gist.github.com/3028193

You will probably have to edit it further to suit your needs, and add a big ass switch since different cameras and software seems to tag different. But this works for iPhone images which is what i primarely got.