HTML

How to check if an image is present in the site or not

Technologies: 

You might want to display an image if the image is present or a template image if it does not exist. There are various ways of doing the same from client side using JavaScript or from server end.

The below example provides another way to check if the image file exists, if so display the image in HTML generated or display the template HTML in Drupal
<?php
if(file_exists($relative_file_path_in_server)){
$image_url= " < img src=".$base_url."/".$relative_file_path_in_server.">";
}else{