/wp-content/themes/wp-foundation/image.php

https://gitlab.com/Blueprint-Marketing/interoccupy.net · PHP · 127 lines · 90 code · 35 blank · 2 comment · 12 complexity · edd73ae086c09e95217a63de5b5908ad MD5 · raw file

  1. <?php get_header(); ?>
  2. <div id="content" class="clearfix">
  3. <div id="main" class="eight columns clearfix" role="main">
  4. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  5. <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">
  6. <header>
  7. <h1 class="single-title" itemprop="headline"><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> &raquo; <?php the_title(); ?></h1>
  8. <p class="meta"><?php _e("Posted", "bonestheme"); ?> <time datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php _e("by", "bonestheme"); ?> <?php the_author_posts_link(); ?>.</p>
  9. </header> <!-- end article header -->
  10. <section class="post_content clearfix" itemprop="articleBody">
  11. <!-- To display current image in the photo gallery -->
  12. <div class="attachment-img">
  13. <a href="<?php echo wp_get_attachment_url($post->ID); ?>">
  14. <?php
  15. $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
  16. if ($image) : ?>
  17. <img src="<?php echo $image[0]; ?>" alt="" />
  18. <?php endif; ?>
  19. </a>
  20. </div>
  21. <!-- To display thumbnail of previous and next image in the photo gallery -->
  22. <ul class="block-grid two-up">
  23. <li class="next pull-left"><?php next_image_link() ?></li>
  24. <li class="previous pull-right"><?php previous_image_link() ?></li>
  25. </ul>
  26. </section> <!-- end article section -->
  27. <footer>
  28. <?php the_tags('<p class="tags"><span class="tags-title">Tags:</span> ', ' ', '</p>'); ?>
  29. </footer> <!-- end article footer -->
  30. </article> <!-- end article -->
  31. <?php comments_template(); ?>
  32. <?php endwhile; ?>
  33. <?php else : ?>
  34. <article id="post-not-found">
  35. <header>
  36. <h1>Not Found</h1>
  37. </header>
  38. <section class="post_content">
  39. <p>Sorry, but the requested resource was not found on this site.</p>
  40. </section>
  41. <footer>
  42. </footer>
  43. </article>
  44. <?php endif; ?>
  45. </div> <!-- end #main -->
  46. <div id="sidebar1" class="four columns clearfix" role="complementary">
  47. <?php if ( !empty($post->post_excerpt) ) { ?>
  48. <div class="caption panel"><?php echo get_the_excerpt(); ?></div>
  49. <?php } ?>
  50. <!-- Using WordPress functions to retrieve the extracted EXIF information from database -->
  51. <div class="panel">
  52. <h3>Image metadata</h3>
  53. <p>
  54. <?php
  55. $imgmeta = wp_get_attachment_metadata( $id );
  56. // Convert the shutter speed retrieve from database to fraction
  57. if($imgmeta['image_meta']['shutter_speed'] > 0){
  58. if ((1 / $imgmeta['image_meta']['shutter_speed']) > 1)
  59. {
  60. if ((number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1)) == 1.3
  61. or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 1.5
  62. or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 1.6
  63. or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 2.5){
  64. $pshutter = "1/" . number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1, '.', '') . " second";
  65. }
  66. else{
  67. $pshutter = "1/" . number_format((1 / $imgmeta['image_meta']['shutter_speed']), 0, '.', '') . " second";
  68. }
  69. }
  70. else{
  71. $pshutter = $imgmeta['image_meta']['shutter_speed'] . " seconds";
  72. }
  73. }
  74. else
  75. $pshutter = 'n/a';
  76. // Start to display EXIF and IPTC data of digital photograph
  77. echo "Date Taken: " . date("d-M-Y H:i:s", $imgmeta['image_meta']['created_timestamp'])."<br />";
  78. echo "Copyright: " . $imgmeta['image_meta']['copyright']."<br />";
  79. echo "Credit: " . $imgmeta['image_meta']['credit']."<br />";
  80. echo "Title: " . $imgmeta['image_meta']['title']."<br />";
  81. echo "Caption: " . $imgmeta['image_meta']['caption']."<br />";
  82. echo "Camera: " . $imgmeta['image_meta']['camera']."<br />";
  83. echo "Focal Length: " . $imgmeta['image_meta']['focal_length']."mm<br />";
  84. echo "Aperture: f/" . $imgmeta['image_meta']['aperture']."<br />";
  85. echo "ISO: " . $imgmeta['image_meta']['iso']."<br />";
  86. echo "Shutter Speed: " . $pshutter . "<br />"
  87. ?>
  88. </p>
  89. </div>
  90. </div>
  91. </div> <!-- end #content -->
  92. <?php get_footer(); ?>