Question
click link to display image - what if image doesn't exist ?
We have a database of over 4,000 rows of sales products, each
with a unique product code eg. C189
we keep photos in a folder beneath the coldfusion pages, using the unique product code as the filename eg. C189.jpg
Typically a user can display 50 rows of products. Each of those rows has a link which the user can click to display the corresponding photo. This part works fine - I just set the image filename as the [product_code].jpg
The issue I have is, we don't have photos for all the products, so sometimes a user will click a link and no image will display. What I'd like is a way of detecting if the image is there when a user clicks a link.
I understand there's a CF command called FileExists , but the reason I haven't chosen to use that is I'm guessing it would be slow - when the user displays say 50 rows of products, wouldn't <CFIF fileExists> have to check each row's image ?
I was hoping there may be a better way ?
we keep photos in a folder beneath the coldfusion pages, using the unique product code as the filename eg. C189.jpg
Typically a user can display 50 rows of products. Each of those rows has a link which the user can click to display the corresponding photo. This part works fine - I just set the image filename as the [product_code].jpg
The issue I have is, we don't have photos for all the products, so sometimes a user will click a link and no image will display. What I'd like is a way of detecting if the image is there when a user clicks a link.
I understand there's a CF command called FileExists , but the reason I haven't chosen to use that is I'm guessing it would be slow - when the user displays say 50 rows of products, wouldn't <CFIF fileExists> have to check each row's image ?
I was hoping there may be a better way ?
