2

I have many images but when one of them is missing it displays an empty <img>. Is there a method or hook that can be used to display a default image instead this empty <img> tag?

2

Install and configure ImageCache Defaults module.

ImageCache Defaults detects file paths in broken images (404 errors) generated by ImageCache (D6) and Image (D7). ImageCache Defaults can either remove images with broken paths from your markup completely or replace them with a configurable default image.

1

How are you building your list of images? If possible, you could add this to your img tags:

<img src="non-existent.jpg" onerror="this.src = 'show-this-instead.png'">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.