Checking array indexes before using them (#1)

This commit is contained in:
Eric van der Vlist 2020-05-09 17:46:21 +02:00
parent e7ee3bd1a7
commit de3b4f2593
1 changed files with 4 additions and 2 deletions

View File

@ -39,8 +39,10 @@ function getNGGalleryImages( $ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset
if ( is_callable( 'exif_read_data' ) ) {
$exif = @exif_read_data( $p->imagePath );
if ( $exif !== false ) {
$item['lon'] = getExifGps( $exif['GPSLongitude'], $exif['GPSLongitudeRef'] );
$item['lat'] = getExifGps( $exif['GPSLatitude'], $exif['GPSLatitudeRef'] );
$item['lon'] = (array_key_exists('GPSLongiture', $exif) and array_key_exists('GPSLongitudeRef', $exif)) ?
getExifGps( $exif['GPSLongitude'], $exif['GPSLongitudeRef'] ) : 0;
$item['lat'] = (array_key_exists('GPSLatitude', $exif) and array_key_exists('GPSLatitudeRef', $exif)) ?
getExifGps( $exif['GPSLatitude'], $exif['GPSLatitudeRef'] ) : 0;
if ( ( $item['lat'] != 0 ) || ( $item['lon'] != 0 ) ) {
$result[] = $item;
} elseif ( isset( $p->imagedate ) ) {