Jump to content

Getimagesize Function Only Run If There Is A File On Server


son

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...