I have a dynamic site that builds most images dynamically every evening at 12:00 pm.
Because the image-building interface is so prone to error, I have to check the existence of each image prior to using them on the site. The way I do it is: 1) The is an application variable containing an array with the 'intended' name of each image and a date last updated. 2) The first time the page loads each morning after creating the images, it does a file exists on each image name (I think there are about 800 images). This executes rather quickly, less than one second. If the image does not exist, the image name is replaced with an alternate. 3) Things display as close to the way as they are intended as possible. What I have found is that fileexists() is the fastest method for checking up on whether or not the images are there. Mike -----Original Message----- From: Jason Davis [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 8:21 AM To: CF-Talk Subject: check for image existence I have about 50,000 images that are displayed across the site. I'm looking for the best mechanisem to replace a "non-exits" image with a default file, and came across this two options. if anyone can share his experince I'll appriciate it: (All 50,000 product photos are sorted in ~ 900 directories. files are sorted using their 3 leftmost character). i.e, Product_id # 303921 will go to the dir: \303\ First option: using CF: <img src="<cfif FileExists("#DirMap#\#left(Product_id,3)#\#Product_id#.jpg">#left(Produc t_id ,3)#/#Product_id#<cfelse>default</cfif>.jpg"> Second option: using javascript: <img src="#left(Product_id,3)#/#Product_id#.jpg" onError="this.src='default.jpg'"> Maybe this figure will help out: I did a small test on a 9000 files directory: <cfdirectory action="LIST" directory="E:\ProductItems\303" name="LongList"> <cfoutput query="LongList"> <cfif FileExists("E:\Syndicate\www.ynet.co.il\home\#NAME#")> #NAME#<br> </cfif> </cfoutput> This went by in 4 seconds, where while eliminative the FileExists, template was finished in 0 seconds. ______________________________________________________________________ Get Your Own Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists