When the linked image in the article fails, you will see an annoying red cross. Although the image has alt attributes that can remedy the meaning of the image, it still gives people an unfriendly feeling.
If you add a judgment to the image, it will not be displayed when loading fails, which can produce a more satisfying user experience.
The code is as follows: