1
所以我在玩read_exif_data函數,並遇到了一個小問題。 如果圖像沒有經緯度&,我必須停止文件上傳。檢查圖像中是否存在經度和緯度經度和緯度
問題是我找不到檢查gps數組是否在exif數據中的方法。
我正在讀取$ _ FILES ['spotImg'] ['tmp_name']的數據而且我確實得到了我的exif。
問題是隻有當圖像中沒有GPS數據時。
if($_FILES['spotImg']['error'] == 0){
$file = "image_".uniqid(). $_FILES['spotImg']['name'];
$img = WideImage::loadFromFile($_FILES['spotImg']['tmp_name']);
//check if exif data is avalible
$temp = $_FILES['spotImg']['tmp_name'];
$exif = read_exif_data($temp, 0, true);
echo "<pre">;
print_r($exif);
echo "</pre>;
}
這是我在想什麼,但忽略了最低工作工作
if(isset($exif['GPSLatitude'])){
//run code if long/latitude was found
}else{
//give a error message if long/latitude was NOT found
}
這是我想檢查是否存在
[GPS] => Array
(
[GPSLatitudeRef] => N
[GPSLatitude] => Array
(
[0] => 55/1
[1] => 41/1
[2] => 2846/100
)
[GPSLongitudeRef] => E
[GPSLongitude] => Array
(
[0] => 12/1
[1] => 33/1
[2] => 1568/100
)
[GPSAltitudeRef] =>
[GPSAltitude] => 68780/4027
[GPSTimeStamp] => Array
(
[0] => 12/1
[1] => 48/1
[2] => 4621/100
)
[GPSSpeedRef] => K
[GPSSpeed] => 0/1
[GPSDateStamp] => 2015:09:16
)