File::getLocationData()
\nn\t3::File()->getLocationData($filename = '');
Get EXIF GEO data for file. Address data is determined automatically if possible
\nn\t3::File()->getLocationData( 'yellowstone.jpg' );
Copied!
| @return array
Source Code
public function getLocationData($filename = '')
{
if (!function_exists('exif_read_data')) return [];
$rawExif = @\exif_read_data($filename);
$exif = [];
if ($rawExif) {
$exif['lat'] = \nn\t3::Geo()->toGps($rawExif['GPSLatitude'], $rawExif['GPSLatitudeRef']);
$exif['lng'] = \nn\t3::Geo()->toGps($rawExif['GPSLongitude'], $rawExif['GPSLongitudeRef']);
$exif = \nn\t3::Arrays($exif)->merge(\nn\t3::Geo()->getAddress($exif['lng'], $exif['lat']));
}
return $exif;
}
Copied!