When using a tag like <img src="https://www.example.com/example.jpg"> it works just fine in the deck itself. However, when sharing the deck, the images don’t show up in the samples and also AnkiWeb says the deck has 0 images.
As for why it does not show the image in samples for shared decks, I can only guess this is for security reasons (cards could contain arbitrary code that would be executed on anyone’s browser who looks at the sample, as if it was ankiweb.net, which is certainly no good), but there is a good reason for which these images are not counted in the media count: Anki does not take into account images that are generated / downloaded on the fly at rendering time, simply because it would be impossible (arbitrary code could be executed, so the only way for Anki to know would be to actually make the rendering, and check for any image in the DOM; however, that would still not be enough, because a script could show an image when the user clicks on a button for example, so Anki would still be wrong).
You’re referring to the post where I shared a script that looks up arbitrary words from an online dictionary. The only hard-coded part are the CSS selectors and the URL, which can be easily updated in the template (or switch the dictionary altogether).
It’s not really about hardcoding a reference, it’s more about having references to external websites at all (instead of a local copy). But I understand some people cannot store all these references, and that some people never work offline (or rarely).
Personally, I would never do that. Relying on fetching internet resources that I could simply mirror locally is what triggers my OCDs but I guess in my case storage space is not an issue…