wp_exif_date2ts example

if ( empty( $meta['copyright'] ) && ! empty( $exif['Copyright'] ) ) {
            $meta['copyright'] = trim( $exif['Copyright'] );
        }
        if ( ! empty( $exif['FNumber'] ) && is_scalar( $exif['FNumber'] ) ) {
            $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
        }
        if ( ! empty( $exif['Model'] ) ) {
            $meta['camera'] = trim( $exif['Model'] );
        }
        if ( empty( $meta['created_timestamp'] ) && ! empty( $exif['DateTimeDigitized'] ) ) {
            $meta['created_timestamp'] = wp_exif_date2ts( $exif['DateTimeDigitized'] );
        }
        if ( ! empty( $exif['FocalLength'] ) ) {
            $meta['focal_length'] = (string) $exif['FocalLength'];
            if ( is_scalar( $exif['FocalLength'] ) ) {
                $meta['focal_length'] = (string) wp_exif_frac2dec( $exif['FocalLength'] );
            }
        }
        if ( ! empty( $exif['ISOSpeedRatings'] ) ) {
            $meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings'];
            $meta['iso'] = trim( $meta['iso'] );
        }
        
Home | Imprint | This part of the site doesn't use cookies.