To add image in block by selecting “PHP code” as the input format the following steps can be followed.
Step 1. Enable PHP filter module.
Administration > Modules > PHP filter
Note: Fresh install of Drupal 7 has PHP Filter module disabled by default. Ensure your role has permission to enable this module.
Step 2 . If we need to add image from theme, we can use the Drupal function drupal_get_path to get the correct path.
Place the below code in Block body.
<?php
$thempath= drupal_get_path('theme', 'themename');
$image1 = array( 'path' => $thempath . '/images/image1.png', 'alt' => 'image alt text', );
print "<a target='_blank' href='http://www.test.com' >". theme('image', $image1) . "</a>";
?>
Note: ‘themename’ is the name of your theme.
Step 3. Select ‘PHP Code’ option from the Text Format dropdown list, and save.