public function exif(array $fields = array()) {
        if (!function_exists('exif_read_data')) {
            return array();
        }

        return $this->_cache(__FUNCTION__, function($file) use ($fields) {
            /** @type \Transit\File $file */

            $exif = array();
            $fields = $fields + array(
                'make' => 'Make',
                'model' => 'Model',
                'exposure' => 'ExposureTime',
                'orientation' => 'Orientation',
                'fnumber' => 'FNumber',
                'date' => 'DateTime',
                'iso' => 'ISOSpeedRatings',
                'focal' => 'FocalLength',
                'latitude' => 'GPSLatitude',
                'longitude' => 'GPSLongitude'
            );

            if ($file->supportsExif()) {
                if ($data = @exif_read_data($file->path())) {
                    foreach ($fields as $key => $find) {
                        $value = '';

                        if (!empty($data[$find])) {
                            // Convert DMS (degrees, minutes, seconds) to decimals
                            if ($key === 'latitude' || $key === 'longitude'){
                                $deg = $data[$find][0];
                                $min = $data[$find][1];
                                $sec = $data[$find][2];
                                $value = $deg + ((($min * 60) + $sec) / 3600);

                            } else {
                                $value = $data[$find];
                            }
                        }

                        $exif[$key] = $value;
                    }
                }
            }

            // Return empty values for files that don't support exif
            if (!$exif) {
                $exif = array_map(function() {
                    return '';
                }, $fields);
            }

            return $exif;
        });
    }
public function exif(array $fields = array()) {
        if (!function_exists('exif_read_data')) {
            return array();
        }

        return $this->_cache(__FUNCTION__, function($file) use ($fields) {
            /** @type \Transit\File $file */

            $exif = array();
            $fields = $fields + array(
                'make' => 'Make',
                'model' => 'Model',
                'exposure' => 'ExposureTime',
                'orientation' => 'Orientation',
                'fnumber' => 'FNumber',
                'date' => 'DateTime',
                'iso' => 'ISOSpeedRatings',
                'focal' => 'FocalLength',
                'latitude' => 'GPSLatitude',
                'longitude' => 'GPSLongitude'
            );

            if ($file->supportsExif()) {
                if ($data = @exif_read_data($file->path())) {
                    foreach ($fields as $key => $find) {
                        $value = '';

                        if (!empty($data[$find])) {
                            // Convert DMS (degrees, minutes, seconds) to decimals
                            if ($key === 'latitude' || $key === 'longitude'){
                                $deg = $data[$find][0];
                                $min = $data[$find][1];
                                $sec = $data[$find][2];
                                $value = $deg + ((($min * 60) + $sec) / 3600);

                            } else {
                                $value = $data[$find];
                            }
                        }

                        $exif[$key] = $value;
                    }
                }
            }

            // Return empty values for files that don't support exif
            if (!$exif) {
                $exif = array_map(function() {
                    return '';
                }, $fields);
            }

            return $exif;
        });
    }
public function exif ( array $ fields = array ( ) ) { if ( ! function_exists ( 'exif_read_data' ) ) { return array ( ) ; } return $ this -> _cache ( __FUNCTION__ , function ( $ file ) use ( $ fields ) { /** @type \Transit\File $file */ $ exif = array ( ) ; $ fields = $ fields + array ( 'make' => 'Make' , 'model' => 'Model' , 'exposure' => 'ExposureTime' , 'orientation' => 'Orientation' , 'fnumber' => 'FNumber' , 'date' => 'DateTime' , 'iso' => 'ISOSpeedRatings' , 'focal' => 'FocalLength' , 'latitude' => 'GPSLatitude' , 'longitude' => 'GPSLongitude' ) ; if ( $ file -> supportsExif ( ) ) { if ( $ data = @ exif_read_data ( $ file -> path ( ) ) ) { foreach ( $ fields as $ key => $ find ) { $ value = '' ; if ( ! empty ( $ data [ $ find ] ) ) { // Convert DMS (degrees, minutes, seconds) to decimals if ( $ key === 'latitude' || $ key === 'longitude' ) { $ deg = $ data [ $ find ] [ 0 ] ; $ min = $ data [ $ find ] [ 1 ] ; $ sec = $ data [ $ find ] [ 2 ] ; $ value = $ deg + ( ( ( $ min * 60 ) + $ sec ) / 3600 ) ; } else { $ value = $ data [ $ find ] ; } } $ exif [ $ key ] = $ value ; } } } // Return empty values for files that don't support exif if ( ! $ exif ) { $ exif = array_map ( function ( ) { return '' ; } , $ fields ) ; } return $ exif ; } ) ; }
Attempt to read and determine correct exif data.

@param array $fields
@returns array
Attempt to read and determine correct exif data .