How do I check if an image returns "Status Code: 404 Not Found"

I have a dynamic img and I want to check if it exists. If it doesn’t then put a default blank image, if it does exist then put the image itself.

If it doesn’t exist it will show a 'Status Code: 404 Not Found' so how can I simply check for that?

Or is there a better way?

Here is a simplified version of my img tag with a ternary operator.

<img dmx-bind:src="'repository/reports/15/image1.png' == 'Status Code: 404 Not Found' ? 'blank_img.png' : 'repository/reports/15/image1.png'" >
Community Page
Last updated: