invisible images in play mode

Dynamically loaded images in Power Apps are invisible

In this post i will look at dynamically loaded images and how these images may not appear in play mode.

Adding images to screens

In Power Apps studio it is easy to create in image control by selecting the Image control from the Media menu.

Dynamically loaded images in Power Apps are invisible 1

You can now Add you images by uploading them to the control or you can upload them within the media library of the app.

Dynamically loaded images in Power Apps are invisible 2

Now within the control you can select the image

Dynamically loaded images in Power Apps are invisible 3

That is easy.

Why create dynamically loaded images?

But how about if you want different images depending on your data. for example you want to show image1 when a number has been set to 1 and image 2 when a number has been set to 2.

Or maybe even show a red, amber or green image depending on a status value.

You might now create 3 image controls on top of each other and only make the one visible that you want. how about if you could just have one control and set the image to the image that you want.

Media URIs in Power Apps

Time to have a look at the way Power Apps references images.

I created an image and a label that displays imgImageControl.Image

Dynamically loaded images in Power Apps are invisible 4

The image uri will now be shown as the following uri in my label


Generating the Uri dynamically

Now I’ve added a label that holds a number in it. and I can use this number to generate the Uri using the expression:

"appres://resources/Image" & Number
Dynamically loaded images in Power Apps

Image visibility in play mode

When I now run the app in play mode I’m finding that my image doesn’t load! This is annoying.

Dynamically loaded images in Power Apps are invisible 5

Sp the power Apps player is doing different things than my Power apps development environment. That is not nice. You would expect that testing an app in the studio environment would be good enough , but it is not.

So when you get your users to use your app do make sure that you have tested the app in play mode first, as these dynamically loaded images may not appear.

I wonder how many other things there are that are loaded in this way as I have seen occasionally similar kind of issues.

Fixing to invisible images

I can see from my first label that the Uri of the image is set correctly however the image doesn’t appear.

How can i resolve this?

I added my images as separate controls on a separate screen. Then I reloaded my app and the image didn appear.

Why does this happen?

It looks like the app will load only those images that have specifically been used in the app. Some how Power Apps seems to ignore the images for which the name has been calculated.

4 thoughts on “Dynamically loaded images in Power Apps are invisible

  1. I don’t have a good answer as to why this happens, but I did run into this same problem and found a *potential* solution.

    I was creating a “main menu” in which I wanted to use custom icon images to help represent the choices. I wanted the images to change color depending on whether a particular item was selected or not, thus leading to the dynamic image strategy. Same deal as your post, when I used the image URIs, it worked in Edit mode but not in Play mode. But I was able to get it working in both modes by referencing the whole image in single quotes (‘) where it needed to be referenced.

    I’ll admit my use case was to reference the whole image name and not search for them as you did in your example, but it may be a good workaround for choosing between a set of images (e.g. traffic light colors).

    1. Hi Dustin,

      Thank you for your comment. I’m quite sure that it has something to do with caching the images. So as long as Power Apps is able to figure out the full name of the file before it needs the file then it is fine.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: