When I upload an image in Composer, it puts a URL in the Image Source property like this:
Is that URL persistent (will never change and never go away) so that I can store that URL in my database and retrieve it to use in an app variable throughout my app? Would this change or remain the same in the build version of the app? I havent tried yet but Im just wondering if this URL wont work any more after i build my app and it tries to access it.
Thanks for the answer in advance.
When a build of your app is made, all the assets are downloaded into the apk/ipa/zip, so as long as the URL is valid as the build is made, the assets will work later on as well. If you want to fetch URLs from a database though, as far as I understand it’s a better practice to not rely on an URL but a storagekey instead, like in our image/file uploads. So while I do think that URL is more permanent than not, I don’t think we can guarantee it to be eternal.
The reason I was wondering is because I have a situation where I need to display a default “blank person” image for user profiles if they dont select their own picture. In this case, the image is set by logic, which therefore requires a variable to represent the URL of the blank-person image, which i need to be able to access and display in different areas of the app.
From your reply, those URLs we see in the static Source value wont be guaranteed to last, so ive uploaded the image to somewhere else permanent. Thanks for your clarification on that.
Yeah, I think this is the best option, just to be on the sure side. Good that this helped to clarify!
Hi Mevi! I have a somewhat similar use case, where I have a small number of images uploaded in Composer, and I want to let the data determine which image asset to display.
You mentioned a “storage key”. How does a “storage key” work for image assets? How can I reliably reference which image to display based on the data?
I tried looking in the forums and in the documentation, but this is all I could find: Storage - Composer
…and it doesn’t mention image assets uploaded in Composer.
Breaking it down:
- What is a “storage key”?
- How can I find the “storage key” for a given image asset uploaded in Composer?
- How can I tell an Image view component to render that asset using the “storage key” as opposed to an image url?