cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerApps Staff AndyPennell
PowerApps Staff

Re: Is it possible to create a gallery from images saved to Media in PowerApps?

In more recent builds the jpgs will be renamed to 0001.jpg, 0002.jpg etc. The Media backstage will still show the original names, but in the filesystem they are auto-named in this fashion. It will be a lot harder to match them up using this Excel trick, sorry.

Highlighted
Yakimo
Level: Powered On

Re: Is it possible to create a gallery from images saved to Media in PowerApps?

Hi Andy

 

So, what is the right way to show the jpegs?

For now - it seems the JPEGS can be shown if only reside at public web site.

If the images are on the same SharePoint tenant - they cannot be shown because of the rights restrictions

 

On my SharePoint site - I have a list of users as well as pictures, and want to make a simple thing - show users with their pictures

How to do that?

 

Thanks,

Yakimo

Justin_Reading
Level: Powered On

Re: Is it possible to create a gallery from images saved to Media in PowerApps?

I have read more recently that the url prefix for imported Media is "appres://" (e.g. appres://resource/filename.file_ext or appres://datasources/...) not 'ms-appdata:///local/Resources/Assets'. Is this for datasources only? This important feature seems to be horribly undocumented, could someone please confirm what the prefix is that we should use when calling an image (using OnSelect for instance) from the imported Media section of an App?

 

https://powerapps.microsoft.com/en-us/blog/introducing-the-data-table-control/ (comment by diamas)

 

2017-08-01_10-38-19.png

ViStr
Level: Powered On

Re: Is it possible to create a gallery from images saved to Media in PowerApps?

 

In my case path looks like 

appres://resources/your_image_name_without_extension

 

Workaround:

1. Create an Excel file on OneDrive with only column table

2. Link it as datasource in PowerApps

3. Upload some image to Media in PowerApps

4. Insert on screen a button with OnSelect property

Patch(Your_Excel_table;{Column_name:'uploaded_image'})

5. Click on the button

 

There will be path to media resources in Excel table.

Viktor Strizhakov
Stevevater
Level: Powered On

Re: Is it possible to create a gallery from images saved to Media in PowerApps?

i've just read through this article and tried both ways of referencing. the msappdata...0001.jpeg seems to pull through images that have been deleted from media. the new appres...image works great with NO ext.

just a note i thoguht was interesting

Stevevater
Level: Powered On

Re: Is it possible to create a gallery from images saved to Media in PowerApps?

just published the app and no pictures are appearing on an android phone even though it works fine in Development studio. Any Ideas???

PowerApps Staff cherie
PowerApps Staff

Re: Is it possible to create a gallery from images saved to Media in PowerApps?

@Stevevater, does it show up if you go to web.powerapps.com and launch it in the web?

Stevevater
Level: Powered On

Re: Is it possible to create a gallery from images saved to Media in PowerApps?

@cherie i dont use the web as i use LoadDate regularly.

 

it seems that the pictures in the media gallery are not sent with the app unless they are directly used in the app. 

 

i used a workaround with switch as there was only 6 images to display in the gallery and referenced the images directly. as soon as i did this the appres:// ... img worked fine. i had this on another screen accidently and it appeard fine once the images were directly referenced somewhere else.

 

not sure if this was fluke or an anomaly, but thats what happened. 

 

i have not yet repeated the process to check the effects or whether the image stays with the link if i remove the direct reference.

 

Steve 

PowerApps Staff joem
PowerApps Staff

Re: Is it possible to create a gallery from images saved to Media in PowerApps?

You should not be using 'appres://' uri's in your app. They are undocumented because these are internal uri's that are used to prevent copying binary data around in data flow.

 

Images in the media backstage should only be referred to in your app via the unique entity name that is seen in the backstage. Do not refer to the 0001.jpg values as they may change from one save of the app to another. Just like you refer to a collection by it's unique name, the media should be used the same way. This also tells the app publisher that the media is used, hence why you noticed those appres's don't work if the images aren't referenced. This shows how these appres uri's are internal data. This is also an optimization that the publisher does, so it doesn't package up media files that are not reference by the app anywhere.

 

The way to refer to your app-saved Media (the ones in the Media backstage) is to create a Collection that you populate on app start and then refer to via some key.

 

Example
Suppose I have the uploaded the following files via the Media Backstage:
- contactJohn.jpg (Entity name: contactJohn)
- contactSue.jpg (Entity name: contactSue)
- contactJane.png (Entity name: contactJane)
- categoryManager.png (Entity name: categoryManager)
- categoryVP.png (Entity name: categoryVP)

 

On the app's OnStart property, I would write a rule like:
ClearCollect(contactMedia, {id:"john", media:contactJohn}, {id:"sue", media: contactSue}, {id:"jane", media: contactJane})

 

Then, in your data or in your app you would use the 'id' column as a lookup. Say I'm in a gallery that's boung do a table with the following columns:
- id: number
- name: string
- imageId: string (where this is one of the values in the contactMedia's id column above)

 

Inside the gallery item's template, I can add an Image control and set its Image property to:
LookUp(contactMedia, id = imageId, image)

 

I hope this helps.

Stevevater
Level: Powered On

Re: Is it possible to create a gallery from images saved to Media in PowerApps?

@joem

 

Thanks for that, it makes perfect sense.

It does mean however that it is a laborious task of setting up each item in the collection manually before being able to reference it in the gallery. I have a set of 52 images that i currently pull from SharePoint as a HTTP link to an image library. it would be better as they do not change to have them directly in the app. this would take a lot of repeated code lines. 

 

unless anyone knows of how I can get the image to store in SaveData (currently only the link saves and still requires the user to be online for the images to appear).

 

Thanks again Joem for your post

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,934)