478
Views
3
Comments
Solved
Mobile app use image with dynamic url
Question

Hi, I am new to outsystems. I am creating a mobile app and want to use the Image widget with a dynamic URL which I received from an external REST API. 

However, when using the widget I am not given an option to insert the URL, only static images.

How would I do this?


https://success.outsystems.com/Documentation/10/Reference/Mobile_Interfaces/Designing_the_Layout/Image

UserImage.jpg
Robin Rodgers
Solution

Turns out, I had to change the "Type" property into "External URL". ServiceStudio wouldn't  let me change the properties before, but now they were editable and it worked! 

2022-07-07 18-45-50
Niels Favreau

You could do this :

- Create a localstorage table : TempTable

- Delete the Id

- Add attribute Image (type binary data)

- When retrieving the image from your rest API, save it in the image attribute from the local storage table you just created.
- Whenever you retrieve a new image from your rest api, overwrite the old image from local storage table with the new image binary data retrieved from your rest api.

- Right click the properties of your screen where you want to use the image.

- Chose : fetch data from local storage

- Use your local storage table where the image is stored

- drag an image widget to your screen.

- on the  type property of the image widget select : Binary Data

- on the image content property of the image widget select the image attribute from the local storage aggregate

- don't forget to refresh the local storage aggregate on your screen whenever needed

That's it. :D
If you can't get it to work, i'll send you an example OML.

UserImage.jpg
Robin Rodgers

Hi Niels and Thanks for your reply! Apologies, it seems I explained wrong, I do not receive any binary data from the REST API, I only receive a url to the image. And both the "Image" and "UserAvatar" widgets don't accept URLs... 

UserImage.jpg
Robin Rodgers
Solution

Turns out, I had to change the "Type" property into "External URL". ServiceStudio wouldn't  let me change the properties before, but now they were editable and it worked! 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.