Page 1 of 1
Detecting missing pictures
Posted: Fri Jun 16, 2006 8:16 am
by hessodreamy
To avoid missing pictures on my site, and show a 'missing picture' image instead, I have been running a periodic file_exists check, and updating a flag in the database to show whether the picture exists or not.
But now I can't see any reason not to use file_exists on the fly. How fast is it? Would it slow down page load?
btw there's maybe 50,000 files in the image folder, if that makes any difference.
Posted: Fri Jun 16, 2006 9:18 am
by Oren
This is realy hard to tell. If the database has it's own super fast server then maybe the database solution would be faster... But I doubt it, chances are that checking this on the fly is faster. Just test it and see what you get.
Posted: Fri Jun 16, 2006 9:18 am
by feyd
try it, find out.
As for having that many files in a single folder... generally not the best of ideas as many file systems don't like having multiple thousands of files in a single directory. They often won't deny you to do it, but performance in that directory will often degrade as more files are added. I'd suggest breaking the directory up into multiple directories.
Posted: Fri Jun 16, 2006 9:24 am
by hessodreamy
hmmm... separating the files had occurred to me, but more for my own benefit rather than server performance. But yeah I do think that would be a good idea.
As for the original problem, if the difference isn't going to be significant, I think I'll go with checking them on the fly, just because the code, and the updating processes would be simpler.
Posted: Fri Jun 16, 2006 9:24 am
by Oren
Man... I've just beat feyd
Edit: Now I'm a real DevNetwork-er

Posted: Fri Jun 16, 2006 10:10 am
by bokehman
If the images are off site the file_exists will be very slow.
Re: Detecting missing pictures
Posted: Fri Jun 16, 2006 10:13 am
by Oren
bokehman:
hessodreamy wrote:To avoid missing pictures on my site
Posted: Fri Jun 16, 2006 10:14 am
by hessodreamy
yeah!