Question

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

  • 8 July 2021
  • 3 replies
  • 24 views

Userlevel 2
Badge +2

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


3 replies

Userlevel 6
Badge +18

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 2
Badge +2

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 6
Badge +18

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