Solved

Showing an alternative (local) picture for a nonexistent external picture


Userlevel 3
Badge +8

Hi,

We have a product database in which we like to show the picture of said product ((preferably) straight) from the suppliers website/webserver. Sometimes the supplier had a picture available, but for some reason it is no longer available. In that case we would like to show an alternative (local) picture.

Is there a way to know when the request for the suppliers picture has failed (i.e. no content, 404 etc…) and we can action that somehow with a follow up and provide another URL? (i.e. http://myindicium.nl/no_image_available.png

rgds Ricky

icon

Best answer by Mark Jongeling 9 July 2021, 12:58

View original

3 replies

Userlevel 7
Badge +23

Hi Ricky,

Indicium does not have this functionality currently but it is something that could be made in the future.

Luckily there is a workaround/solution. IIS does support redirecting of requests, so what you could do is if a request is made to find a picture but the website returns a 404, that you then redirect to a local website/picture/file and show that. Would that suffice? 

Userlevel 3
Badge +8

The IIS redirecting will not work because the client is making requests straight to the suppliers website - and that would be the place to put the redirect on - but that’s not my server, its the supplier one :-)

---

If the client gets a 404 in return and we could action that, then we would be able to say to the client ‘Hey you got a 404 for this image right? - instead get this local http://indicum.nl/not_found_image.png’ - but I don’t know how to action a 404 caught by the client (My guess it isn’t possible, since for example a html component only fetches the given URL and that is about the only action you get)

Userlevel 7
Badge +23

Good point, that is indeed then not possible. We think this is better to implement as part of the model itself, being able to have a sort of fallback image for the previewer. Could you make an Idea for this? Thanks!

Reply