Saturn @ 9AU
// Get EXIF data from wordpress database
$imgmeta = wp_get_attachment_metadata( $id );
$imgmeta = $imgmeta['image_meta'];
// Convert the shutter speed to fraction
if ((1 / $imgmeta['shutter_speed']) > 1) {
if ( ( number_format((1 / $imgmeta['shutter_speed']), 1)) == 1.3
or number_format((1 / $imgmeta['shutter_speed']), 1) == 1.5
or number_format((1 / $imgmeta['shutter_speed']), 1) == 1.6
or number_format((1 / $imgmeta['shutter_speed']), 1) == 2.5
) {
$pshutter = "1/" . number_format((1 / $imgmeta['shutter_speed']), 1, '.', '') . " second";
} else {
$pshutter = "1/" . number_format((1 / $imgmeta['shutter_speed']), 0, '.', '') . " second";
}
} else {
$pshutter = $imgmeta['shutter_speed'] . " seconds";
}
// Start to display EXIF data of photograph
//echo "Camera: " . $imgmeta['camera'] . "
"; //echo "Lens: " . $imgmeta['comment'] . "
"; //echo "ISO: " . $imgmeta['iso'] . "
"; echo "Aperture: ƒ/" . sprintf( "%01.1f", $imgmeta['aperture'] ) ."
"; echo "Focal Length: " . sprintf( "%01.0f", $imgmeta['focal_length'] ) . " mm
"; echo "Shutter Speed: " . $pshutter . "
"; //echo "Date Taken: " . date("Y-m-d", $imgmeta['created_timestamp']) . "
"; /*** // Get EXIF GPS from file $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $exif = @exif_read_data($src[0], 0, true); if( $exif['GPS'] ) { if ( $exif['GPS']['GPSLatitude'] != '' ) { echo "GPS Latitude: N " . getGPS($exif['GPS']['GPSLatitude']) . "
"; echo "GPS Longitude: E " . getGPS($exif['GPS']['GPSLongitude']) . "
"; } if ( $exif['GPS']['GPSAltitude'] != '' ) { echo "GPS Altitude: " . gps2Num( $exif['GPS']['GPSAltitude'] ) . " m
"; } // Google Maps link echo "View on Map
"; } */// ?>
"; //echo "Lens: " . $imgmeta['comment'] . "
"; //echo "ISO: " . $imgmeta['iso'] . "
"; echo "Aperture: ƒ/" . sprintf( "%01.1f", $imgmeta['aperture'] ) ."
"; echo "Focal Length: " . sprintf( "%01.0f", $imgmeta['focal_length'] ) . " mm
"; echo "Shutter Speed: " . $pshutter . "
"; //echo "Date Taken: " . date("Y-m-d", $imgmeta['created_timestamp']) . "
"; /*** // Get EXIF GPS from file $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $exif = @exif_read_data($src[0], 0, true); if( $exif['GPS'] ) { if ( $exif['GPS']['GPSLatitude'] != '' ) { echo "GPS Latitude: N " . getGPS($exif['GPS']['GPSLatitude']) . "
"; echo "GPS Longitude: E " . getGPS($exif['GPS']['GPSLongitude']) . "
"; } if ( $exif['GPS']['GPSAltitude'] != '' ) { echo "GPS Altitude: " . gps2Num( $exif['GPS']['GPSAltitude'] ) . " m
"; } // Google Maps link echo "View on Map
"; } */// ?>