Hi Joao,
Based on the shared JS code snippet, I have observed that the ImageExists function defintion is available/defined but invoking/calling of the function is missing i.e. ImageExists();
I have tried to implement the mentioned use-case by using the same JS code but it's not woking (throwing cross-domain console error).
The solution which I found working is https://stackoverflow.com/a/18837818
See this sample app ExternalImageUrlDemo
More info about - $resolve();
Refer to the attached .oml file
Hope this helps you!
Kind regards,
Benjith Sam