When there is no image.php template file, WordPress automatically use single.php template file to present the medium-size photo
When there is an image.php template file that makes use of WordPress image gallery functions, the photo gallery navigation looks more attractive and intuitive, where two hyperlinked thumbnails of next and previous image in relative to current medium-size picture
How to create an image.php template file for WordPress theme if there is no one currently?
The simple way to create image.php template file is to duplicate single.php as image.php and exercise these steps:
1) Open image.php with your favourite text editor,
2) Locate and remove the_content() function call with these “previous and next image link” functions:
<div style=”float:right;”><?php next_image_link() ?></div><?php previous_image_link() ?><br />
<div style=”text-align: center;”><a href=”<?php echo wp_get_attachment_url($post->ID); ?>”><?php echo wp_get_attachment_image( $post->ID, ‘medium’ ); ?></a></div>
<?php if ( !empty($post->post_excerpt) ) the_excerpt(); ?><br />
3) Replace the_title() function call with this line to show the post permalink of photo gallery:
<a href=’<?php echo get_permalink($post->post_parent); ?>’ rev=”attachment”><?php echo get_the_title($post->post_parent); ?> </a>