Checking array indexes before using them (#1)
This commit is contained in:
parent
e7ee3bd1a7
commit
de3b4f2593
|
@ -39,8 +39,10 @@ function getNGGalleryImages( $ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset
|
||||||
if ( is_callable( 'exif_read_data' ) ) {
|
if ( is_callable( 'exif_read_data' ) ) {
|
||||||
$exif = @exif_read_data( $p->imagePath );
|
$exif = @exif_read_data( $p->imagePath );
|
||||||
if ( $exif !== false ) {
|
if ( $exif !== false ) {
|
||||||
$item['lon'] = getExifGps( $exif['GPSLongitude'], $exif['GPSLongitudeRef'] );
|
$item['lon'] = (array_key_exists('GPSLongiture', $exif) and array_key_exists('GPSLongitudeRef', $exif)) ?
|
||||||
$item['lat'] = getExifGps( $exif['GPSLatitude'], $exif['GPSLatitudeRef'] );
|
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 ) ) {
|
if ( ( $item['lat'] != 0 ) || ( $item['lon'] != 0 ) ) {
|
||||||
$result[] = $item;
|
$result[] = $item;
|
||||||
} elseif ( isset( $p->imagedate ) ) {
|
} elseif ( isset( $p->imagedate ) ) {
|
||||||
|
|
Loading…
Reference in New Issue