External URL to internal images Suppose I have a link field for internal images. $node-&gt;file_image-&gt;uri will for instance return:

internal:/sites/default/files/image/image.jpeg


I need to convert this into an absolute URL for metadata. I can do this manually, of course, but let's see what the usual functions do:

file_create_url() = "https://example.com/internal%3A/sites/default/files/image/image.jpeg"
file_build_uri() = "public://internal:/sites/default/files/image/image.jpeg"
file_create_url(file_build_uri()) = "https://example.com/sites/default/files/internal%3A/sites/default/files/image/image.jpeg"


No cigar, not even close. The new functions?

Url::fromUri()-&gt;toString() = "internal:/sites/default/files/image/image.jpeg"
Url::fromUri()-&gt;toUriString() = "base:sites/default/files/image/image.jpeg"


So, how to do it without doing it manually, of course? Removing internal: and prepending $base_url is very simple but still a hack.
Found it finally:

Url::fromUri($node-&gt;field_image-&gt;uri)-&gt;setAbsolute(TRUE)-&gt;toString()