Using the file setting in addon.xml allows users to upload a file/image/etc using the Elfinder.
How do we get the file as a URL, or at least a URi? Calling registry just returns the relative path to the file that doesnt include higher folders, and it varies on accuracy.
For example, after uploading an image at "/images/companies/2/img.jpg" while in "all stores" mode, the registry (setting) for this field is saved as "companies/2/img.png". This is because in all stores there is a higher starting root of "/images"
Now if i do the same thing but in a storefront instead of "all stores" mode, the Elfinder root is now "/images/companies/2/". Uploading the file still goes to "/images/companies/2/img.jpg", but now the registry (setting) for this field is saved as "img.png".
I dont think CS is doing image pairing for this type of upload, and i didnt see any "generate a url with this image" functions that dont require image/object type or id.
Its pretty easy to do something like this if the setting comes from specific store:
$image = Registry::get('config.current_location') . '/images/companies/' . $company_id . '/' . Registry::get('addons.something.image');
But its not very accurate if someone puts it rando in "all stores" mode (ie, setting an image in an addon for all storefronts). Any ideas?