public function File::geocode in Geocoder 7.2
File
- src/
Geocoder/ Provider/ File.php, line 15
Class
- File
- @author Pol Dellaiera <pol.dellaiera@gmail.com>
Namespace
Geocoder\ProviderCode
public function geocode($filename) {
if ($exif = exif_read_data($filename)) {
if (isset($exif['GPSLatitude']) && isset($exif['GPSLatitudeRef']) && $exif['GPSLongitude'] && $exif['GPSLongitudeRef']) {
$latitude = $this
->getGPSExif($exif['GPSLatitude'], $exif['GPSLatitudeRef']);
$longitude = $this
->getGPSExif($exif['GPSLongitude'], $exif['GPSLongitudeRef']);
return $this
->returnResults([
array_merge($this
->getDefaults(), [
'latitude' => $latitude,
'longitude' => $longitude,
]),
]);
}
}
throw new NoResult(sprintf('Could not find geo data in file: "%s".', basename($filename)));
}