cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Image resource not loading with app

OK. Here is my app scenario: I have created an app that includes several images as resources, but which does not directly use the images in an image control on a screen. The images are called and displayed in an image control only when the result of a formula triggers them in the App. The whole things works great when I am building it and previewing it. However, when I publish the app and run it, none of the images show up. I have discovered that if I do put the image directly onto a screen somewhere in the app, then those images will display when called by the formula. As far as I can tell, what is happening is that the App is not loading the image resources because it does not look like they are used in the app. I guess I could trick the app by loading all of the images on a screen and making them not visible, but I am hoping there is some other way to force the App to load the image resources without having to build them explicitly onto a screen. Any ideas?

5 REPLIES 5
Highlighted
Community Champion
Community Champion

Re: Image resource not loading with app

Could you please clarify what you mean by 'includes several images as resources'?  Are the images added to the media of the app, if not, where are they stored?

What is the formula you use in the image control?

Highlighted
Regular Visitor

Re: Image resource not loading with app

@Meneghino, yes, the images were uploaded into the "Media: Images" section of the online PowerApp studio. They are then called in the app through the following process:

1) There is an Image Control on a screen whose image property is set to the variable "image". This variable is initially blank, as I do not want an image on the screen when it loads.

2) There is a button on the screen that randomly selects one of the images. I accomplish this by having a collection created ("Notes") with the names of the image files as its values, then using the Rand function (using a variable "RndSelector") to assist in selecting a random record from that collection. The varible "image" is then set to the selected image name, along with the additional text needed to refer to the media image:

 

UpdateContext({Image: Concatenate("appres://resources/",Last(FirstN(Notes,RndSelector)).Value)});

 

This works great when building the app and when previewing the app. However, when I open the published version, either on a desktop machine or through the mobile app, no images appear.

 

HOWEVER, if I "preload" the images directly into an image control, say, on another screen of my app, then those images do display correctly as a result of my formula in the variable-controlled image control. This is telling me that PowerApps DOES NOT load an image resource from the media unless it is called directly in the App. I was only wondering if there was a way to avoid creating the dummy image controls and have the App load all media resources, regardless of whether they are directly called by a control in the App.

 

I hope this helps clarify. My issue is not with my formula, but rather with how PowerApps loads media resources.

 

Thanks!

Highlighted
Super User
Super User

Re: Image resource not loading with app

I faced the same issue and the only solution seems to creat that dummy screen and load all the images there.

I haven’t tried this yet, but you could first collect all the images into the collection and then use the random function to randomly select one of the records.


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Community Champion
Community Champion

Re: Image resource not loading with app

Apologies running late so quick reply.  You should refer to the images as a variable, no need to do the concatenate, I think.

in other words, if the image name is Foo or Bar then the collection should contain Foo and not "Foo" as text.  Then you do not need the concatenate.  Gotta run...

Highlighted
Regular Visitor

Re: Image resource not loading with app

I am wondering if anyone found a solution to this.

 

I can confirm this behaviour still exists (and it is as much a pain as it is unnecessary).

Images that are uploaded into the "storaged media" section but are not fixed referenced to in the app (f.i. by having an image control directly connect to the image file) are working perfectly fine on desktop but seem to be not part of the mobile app at all.

(In a way this would make sense: an automatic check by powerapps and only delivering those media files to the mobile app which it thinks are necessary. All files which are not directly referenced to at start of the app are considered "garbage" and will not be available in the mobile app at runtime. However please make such memory "optimizations" customable and put the decision in the hand of the programmer).


Adding those files to a "collection" does not help to solve the issue, they remain unavailable.

As the threadstarter described: only creating a (hidden) fixed image per image file makes them available to the app. If you have 10+ images which could change and have to be updated this becomes a nuisance.

 

Is there anyway to "force" the inclusion of (all) media files to the mobile app?

Thanks in advance for any help.

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,530)