diff --git a/main.inc.php b/main.inc.php index ba5e464..724283c 100644 --- a/main.inc.php +++ b/main.inc.php @@ -1,7 +1,7 @@ $section) { - foreach ($section as $name => $val) { - if(substr( $name, 0, 3 ) === "GPS") - { - if($name === "GPSLatitude" or $name === "GPSLongitude") - { - /* convert to x/1 y/1 z/... format */ - $p1 = explode("deg", $val); - $v1 = intval($p1[0]) . "/1"; - $p2 = explode("'", $p1[1]); - $v2 = intval($p2[0]) . "/1"; - - $p3 = explode("\"", $p2[1]); - $v3 = intval($p3[0] * 10000) . "/10000"; - - $exif[$name] = array($v1, $v2, $v3); - } - else if($name === "GPSLatitudeRef" or $name === "GPSLongitudeRef") - { - $exif[$name] = substr($val, 0, 1); + $exif = array(); + if(is_array($metadata)) { + foreach ($metadata as $key => $section) { + if(!is_array($section)) { + continue; + } + foreach ($section as $name => $val) { + if(substr( $name, 0, 3 ) === "GPS") + { + if($name === "GPSLatitude" or $name === "GPSLongitude") + { + /* convert to x/1 y/1 z/... format */ + $p1 = explode("deg", $val); + $v1 = intval($p1[0]) . "/1"; + $p2 = explode("'", $p1[1]); + $v2 = intval($p2[0]) . "/1"; + + $p3 = explode("\"", $p2[1]); + $v3 = intval($p3[0] * 10000) . "/10000"; + + $exif[$name] = array($v1, $v2, $v3); + } + else if($name === "GPSLatitudeRef" or $name === "GPSLongitudeRef") + { + $exif[$name] = substr($val, 0, 1); + } + else + { + $exif[$name] = $val; + } } - else - { - $exif[$name] = $val; - } } } } - return $exif; } ?>