If the image is hosted on Discord's servers and the filename starts with "SPOILER_", it should be hidden like an attachment in a regular message.
I know there are similar requests. (Ex. https://support.discord.com/hc/en-us/community/posts/360055493812-Enable-spoilering-of-images-in-rich-embeds https://support.discord.com/hc/en-us/community/posts/360043419812-Ability-to-mark-as-spoiler-images-in-rich-embeds )
I'm sure to this idea is very nice. It is deplorable that they have been abandoned for four years.