cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JamesM
Level 8

Unable to get Image control which derives the image from a URL to update within the APP

I have an image control in a test app, where the image is derived from a URL, e.g. 

 

Image = ("https://s3-ap-southeast-2.amazonaws.com/api-dev-jupyter-notebook-s3/graph_sales.png")

 

I am working on a solution that allows that image to be updated (while retaining the same file name). Now in my mind, this should allow the image reference to either 

 

a) automatically update

b) Be able to update via a button click or timer. I've tried a button that sets this image to the same URL again, and a timer where the timer end sets the image controls image property to the same URL again (after the image has been updated).  Unfortunately, the image doesn't update. Not unless I quit out of the app and re-launch (or possibly navigate to a different screen and back again, I haven't tested that).  Is this simply not possible in PowerApps, or am I missing something? There's no 'refresh' command for an image sadly. 

 

If I can get this to work, then I have a way to dynamically generate some really interesting and cool graphs, and wanted to do a tutorial on it, but without this piece of the puzzle, it's essentially useless. 

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps Staff Mr-Dang-MSFT
Power Apps Staff

Re: Unable to get Image control which derives the image from a URL to update within the APP

Hi @JamesM,

It looks like you want to use the same URL, update it, and see a different result. The problem you're encountering is the content from the URL is caching. 

 

So you need a way to tell PowerApps "I have a new version of this same URL."

 

Here's how I would do it today:

  1. Show the image in image box, Image1.
  2. Have a button that updates the Image, ex:
    Set(image,AzureBlobStorage.UpdateFile(test.Id,AddMediaButton1.Media));
  3. Make the same button reset a variable at the same time that it updates an image
    Set(wait,true);
    Set(image,AzureBlobStorage.UpdateFile(test.Id,AddMediaButton1.Media));
    Set(wait,false)
    Since the variable is flipping on, then off when the image is updated, we can take advantage of that.

  4. I make image appear when that variable is false again:
    If(!wait,
        image
    )

For a moment, the wait variable is true, so there's no image. At that time, the image is being updated. When the image is done updating, wait is returned to false. So the image box will attempt to show the URL again. It should be updated by then.

 

Let me know if this works for you.

 

Note: I've attached an msapp file (File > Open > Browse) . It has what I used for testing, but it's tied to Azure Blob.

image.png

 

View solution in original post

2 REPLIES 2
JamesM
Level 8

Re: Unable to get Image control which derives the image from a URL to update within the APP

Anyone have any ideas? I'm super keen to write this tutorial, but it's for naught if I can't solve this part. 

Power Apps Staff Mr-Dang-MSFT
Power Apps Staff

Re: Unable to get Image control which derives the image from a URL to update within the APP

Hi @JamesM,

It looks like you want to use the same URL, update it, and see a different result. The problem you're encountering is the content from the URL is caching. 

 

So you need a way to tell PowerApps "I have a new version of this same URL."

 

Here's how I would do it today:

  1. Show the image in image box, Image1.
  2. Have a button that updates the Image, ex:
    Set(image,AzureBlobStorage.UpdateFile(test.Id,AddMediaButton1.Media));
  3. Make the same button reset a variable at the same time that it updates an image
    Set(wait,true);
    Set(image,AzureBlobStorage.UpdateFile(test.Id,AddMediaButton1.Media));
    Set(wait,false)
    Since the variable is flipping on, then off when the image is updated, we can take advantage of that.

  4. I make image appear when that variable is false again:
    If(!wait,
        image
    )

For a moment, the wait variable is true, so there's no image. At that time, the image is being updated. When the image is done updating, wait is returned to false. So the image box will attempt to show the URL again. It should be updated by then.

 

Let me know if this works for you.

 

Note: I've attached an msapp file (File > Open > Browse) . It has what I used for testing, but it's tied to Azure Blob.

image.png

 

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

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