How to check whether an image exists or not from image path?

Guys! let me know, How to check whether an image exists or not from image path?

To check image existence you can use below function. You just need to pas the image URL in this function and it will return true or false, this way you can identify and show image based on it's existence.

//Check whether image exists or not
function UR_exists($url){
   
    if (@getimagesize($url)) {
        return true;
    } else {
        return false;
    }
}