I’ve got your average e-Commerce app, I store ITEM_IMAGE_NAME in the database, and sometimes managers MISSPELL the image name.
To avoid ‘missing images’ (red X in IE), every time I display the list of products, I check the server for the image related to the product, and if that file doesn’t exist – I replace it with default image.
As far as i can tell this doesn’t affect performance, but I was wondering if there are any alternatives to fix a ‘missing image’ problem.
I’m using ASP.NET + C# (.NET 3.5)
Some code:
foreach (Item item in Items) { string path = Path.Combine('~/images/', item.categoryImage); item.categoryImage = File.Exists(Server.MapPath(path)) ? item.categoryImage : GetImageDependingOnItemType(); }
You might consider something with javascript
Edit: Or program a 404.aspx returning a default image, if a nonexisting image was requested.