 <p>You should use next code:</p> <pre><code>try { $img = @getimagesize($image); echo "&lt;a href='$image'&gt;&lt;img src=\"$image\" width='300' height='150'/&gt;&lt;/a&gt;"; } catch(Exception $e) { echo "&lt;img src='".plugins_url()."/plugins/images/image_not_found.jpg' width='300' height='150'/&gt;"; } </code></pre>