How to make the image helper load images from an external domain?

How to make the image helper – static_path(...) load images, or certain images only, from an external domain?

You can configure :static_url for your endpoint module:

https://hexdocs.pm/phoenix/1.5.8/Phoenix.Endpoint.html#module-runtime-configuration

1 Like

Yeah, thx.

That’s a static setting - load all the assets either locally or from a remote server? Is there a way to make it load assets from an external website only in a dynamic manner? Namely, in some cases I’d load the assets locally, in others - externally, depending on some condition, specified, preferably, in runtime.

If it’s dynamic, then the static_url helper is not the right tool to use. You can always create your own helpers.