cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mandopelli
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?

8 REPLIES 8
Meneghino
Community Champion
Community Champion

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?

@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!

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.

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...

Anonymous
Not applicable

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.

I can confirm in 2021 this is still an issue!

Laurent_Revel
New Member

Hi,

 

The issue is the same when trying to show images through its url "appres://resources/" and name. It works in the browser but not when app is embedded in Teams.

 

Help will be appreciated.

 

Laurent.

Laurent_Revel
New Member

It works when images are preloaded !

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,435)