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