How to set default image in php
How to set default value to input type=file in php
How to set default value for input type=file in jquery!
How to set a default image when an image fails to load
Image loading in websites fail for many reasons. It could be that the of the image contains a broken link.
Or, the internet connection may be poor, and not enough to fetch the image from an external source. Or, the image's server (which may be external) may be down.
When images don't load, the text is displayed in the container with a tiny icon signifying a broken image, like so:
This view can affect UX especially when the text begins to exceed the image container.
We can display default iamges (instead of alt texts) when an image is not fetched correctly for whatever reason.
The better solution is to install the image thumbnailer addon.And in this article, we'll see how.
The event
According to [MDN](How to set a default image when an image fails to load),
The error event is fired on an Element object when a resource failed to load, or can't be used.
For example, if a script has an execution error or an image can't be found or is invalid.
When an image fails to load due to connection, broken link, or whatever reason, the event is fired. And this is where we set the default im