I have just updated Exifography to version 1.3.1. The changes in the plugin are relatively small, but one thing it does enable is to fetch geo data from images in a variety of formats.
In the future this should make it easier to build add-on plugins, such as a map-based directory of photos. For now if you have a particular use for the raw location data from a photo you can extract it with PHP like this:
if (class_exists('exifography')) {
$exif = new exifography();
return $exif->display_geo($imgID,$output);
}
The function display_geo($imgID,$output);
takes two parameters: the first is the image ID, and the second is the format of the data that will be returned. If you use a specific image ID it will get the location data for that image (as long as it’s saved in the database). If you want to get the featured image ID, or first image attached to the post automatically you can set the image ID parameter to null
, as long as you use the function within the loop the plugin will handle the rest. The output formats available are as follows:
dec
– comma separated latitude and longitude in decimal format (e.g., -28.135953,153.484894)coords
– coordinates in minutes and degrees (e.g., 28° 8′ 9.43″ S 153° 29′ 5.62″ E)url
– URL to Google maps (e.g., //maps.google.com/maps?q=-28.135953,153.484894&ll=-28.135953,153.484894&z=11)map
– image URL for a Google map, requires API key to display (e.g., //maps.googleapis.com/maps/api/staticmap?zoom=2&size=200×200&maptype=roadmap &markers=color:blue%7Clabel:S%7C-28.135953,153.484894&sensor=false)
The first one is probably going to be the most useful for integrating with any other tools, but since I already use the others within the plugin, I have made them accessible too.
If you have requests, questions, suggestions, feel free to add them below, or raise an issue in Github.
Leave a Reply