Created
September 18, 2010 00:17
-
-
Save mattrude/585183 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********************************************************************************* | |
Using WordPress functions to retrieve the extracted EXIF | |
information from database | |
*/ | |
function mdr_exif() { ?> | |
<div id="exif"> | |
<h3 class='comment-title exif-title'><?php _e('Images EXIF Data'); ?></h3> | |
<div id="exif-data"> | |
<?php | |
$imgmeta = wp_get_attachment_metadata( $id ); | |
// Convert the shutter speed retrieve from database to fraction | |
$image_shutter_speed = $imgmeta['image_meta']['shutter_speed']; | |
if ($image_shutter_speed > 0) { | |
if ((1 / $image_shutter_speed) > 1) { | |
if ((number_format((1 / $image_shutter_speed), 1)) == 1.3 | |
or number_format((1 / $image_shutter_speed), 1) == 1.5 | |
or number_format((1 / $image_shutter_speed), 1) == 1.6 | |
or number_format((1 / $image_shutter_speed), 1) == 2.5){ | |
$pshutter = "1/" . number_format((1 / $image_shutter_speed), 1, '.', '') ." ".__('second'); | |
} else { | |
$pshutter = "1/" . number_format((1 / $image_shutter_speed), 0, '.', '') ." ".__('second'); | |
} | |
} else { | |
$pshutter = $image_shutter_speed ." ".__('seconds'); | |
} | |
} | |
// Start to display EXIF and IPTC data of digital photograph | |
echo "<p>" . date("d-M-Y H:i:s", $imgmeta['image_meta']['created_timestamp'])."</p>"; | |
echo "<p>" . $imgmeta['image_meta']['camera']."</p>"; | |
echo "<p>" . $imgmeta['image_meta']['focal_length']."mm</p>"; | |
echo "<p>f/" . $imgmeta['image_meta']['aperture']."</p>"; | |
echo "<p>" . $imgmeta['image_meta']['iso']."</p>"; | |
echo "<p>" . $pshutter . "</p>" | |
?> | |
</div> | |
<div id="exif-lable"> | |
<?php // EXIF Titles | |
echo "<p><span>".__('Date Taken:')."</span>"; | |
echo "<p><span>".__('Camera:')."</span>"; | |
echo "<p><span>".__('Focal Length:')."</span>"; | |
echo "<p><span>".__('Aperture:')."</span>"; | |
echo "<p><span>".__('ISO:')."</span>"; | |
echo "<p><span>".__('Shutter Speed:')."</span>"; ?> | |
</div> | |
</div> | |
<?php } | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*EXIF table*/ | |
#exif { overflow: hidden; margin: 0; padding: 0 10px 0 0; } | |
#exif-lable { margin: 0 0 0 15px; width: 125px; } | |
#exif-lable p { margin: 0; } | |
#exif-lable span { font-weight:bold; } | |
#exif-data { overflow: hidden; margin: 0; float: right; width: 540px; } | |
#exif-data p { margin: 0 10px; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php mdr_exif(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment