0
尝试从照片exif中提取位置数据,但它仅显示GPS数据的'阵列'。它需要将数据保存到服务器上的日志文件中进行刮取。难道我做错了什么?照片上肯定有地理定位数据。提取EXIF数据显示'阵列'
<?php
$image = "narnia.jpg";
$exif = exif_read_data($image, 0, true);
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<pre>\n</pre>";
}
}
?>
GPS.GPSLatitudeRef: N
GPS.GPSLatitude: Array
GPS.GPSLongitudeRef: W
GPS.GPSLongitude: Array
GPS.GPSTimeStamp: Array
谢谢,我添加的代码之下,它的工作。我试过调整它,只打印GPS阵列,因为这是我所需要的。 '$ image =“narnia.jpg”; $ exif = exif_read_data($ image,0,true); $ lon = getGps($ exif [“GPSLongitude”],$ exif ['GPSLongitudeRef']); $ lat = getGps($ exif [“GPSLatitude”],$ exif ['GPSLatitudeRef']); var_dump($ lat,lon);' 但这不起作用。我也试过'print_r($ lat,lon);'而不是'var_dump' – ArrayOutOfBounds