Jump to content

Getimagesize Function Only Run If There Is A File On Server


son
 Share

Recommended Posts

I use the getimagesize function to display product photos whose names are stored in db and which are always stored in same folder. The code for getimagesize bit is:

$size = getimagesize("../products/basket/{$img}");

Now, I had to delete the files on server to run a test and names were still stored in database. Accessing this page which displays the photos it obviously threw some errors as there were no photos with relevant names (taken from db). It should not be the case that there are image names in database and no files on server, but you never know... What would I need to do before useing the getimagesize function to make sure it only runs if there is a file on server? Maybe even display a placeholder image then...Son

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

×
×
  • Create New...