Jump to content

Check if Image exists before download


Tom.
 Share

Recommended Posts

Hey, 

So we have this system that pulls in from an API and downloads images. It's been working great however, the API has been spotty recently. It's been giving us images that are inaccessible or do not exist.

This is the code we have to add images:

if ($type == "0") {
	$p->images->add($url);
}

Pretty simple. Is there a way to check if the image is accessible before trying to download?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...