cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rwittels
Advocate III
Advocate III

Caching images offline

Hi. I just need confirmation that I am doing this correctly please. I have 4 images in my app which were uploaded to the Media section and are listed under the heading Images. I would like to cache my images OnStart. I have used this code:

ClearCollect(appImages, {Images: ["Image1.png", "Image2.png", "Image3.png", "Image4.png"] })

Am I doing this correctly?

Do I need to do anything on each image within the app screens?

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User
Super User

Consider this:

 

ClearCollect(

    appImages,

    {ID:1, Image: Image2},

    {ID:2, Image: Image2},

    {ID:3, Image: Image3},

    {ID:4, Image: Image4},

    {ID:5, Image: Image5})

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

5 REPLIES 5
eka24
Super User
Super User

Consider this:

 

ClearCollect(

    appImages,

    {ID:1, Image: Image2},

    {ID:2, Image: Image2},

    {ID:3, Image: Image3},

    {ID:4, Image: Image4},

    {ID:5, Image: Image5})

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Thank you for the reply. I am trying to use appImages.ID=1 in the image's Image property on the screen and it doesn't work. What is the correct syntax to access the image?

Yes ignore the extension.

In the image of the Gallery:

LookUp(appImages,ID=ThisItem.ID,Image)
 
Am assuming you have a common column like ID between your datasource for the Gallery and the Image collection.
 
Your can change the Name ID to and identical column 
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

LookUp(appImages,ID=1,Image) works. If images were added as media, does adding them to a collection like this improve performance?

LookUp to the image is ok because the images are already in the App through a collection.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,112)