Before displaying an image on the screen with a simple function, check that the image actually exists.
The path to the file or image will check the response to the HTTP request.
Visit on page: https://dev-all.eu/blog/how-to-check-with-php-if-image-exists