Snippet. PHP. Find, if Image Exists on Remote Server

This PHP snippet finds, if an image exists on remote server.

if (@getimagesize($url_image) === false) {
    echo "Image DOES NOT exist";
}

Do not use file_exists or fopen. There is connection timeout problem.


Updated on: 23 Nov 2024