WordPress shortcode for image with caption

You should add the below code in the functions.php file.

function image_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'link' => 'http://placehold.it/300x200',
'alt'=>'image absent',
), $atts ) );
return '<style type="text/css">
.alignleft {
float: left;}
.wp-caption {
background-color: #DDDDDD;
border: 1px solid #BBBBBB;
border-radius: 3px;
padding: 5px;margin:5px;
text-align: center;

<figure ><img src="'.$link.'" height="'.$height.'" width="'.$width.'" alt="'.$alt.'" /><figcaption>'.$caption.'</figcaption></figure>' ;
add_shortcode( 'image', 'image_shortcode' );


To add image src with its caption, width and height.

In the post you have to add this code:

[image link="http://media-cache-ak0.pinimg.com/236x/60/49/22/604922727c72015aa699f9a0f7d04683.jpg" height="450" width="236" alt="Camogli - Liguria, Italy" caption="Camogli - Liguria, Italy"]

The image will show like this:
Camogli - Liguria, Italy
Camogli - Liguria, Italy

Image shows here