cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos

Allow uploaded images to be displayed using HtmlText

See response below, this is solved.

 

Hello, 

I'm using the Site Inspections template and added some code to allow a user to save their inspection as a PDF. I'm using an HtmlText to format the PDF. I can pull in all the data I need. The problem is the information that is sent to me from the Photo is a jumbled mess and can't be used to render the image using an <img src=> tag. I can't seem to get that to load for anything. Searching around the internet I saw that other users have asked questions about this and that it is not currently a feature available in PowerApps. Please add this feature, not that it will help me now, but it really should be a feature. 

Status: New
Comments
Level: Powered On

Actually, you can display the image in HtmlText. I'm using the default template for Site Inspections. So the native behavior is that a user can take pictures with their device (phone, computer, etc) and those uploaded photos go into the default Gallery, in my case it was Gallery1. I used a Concat function to iterate thru the Gallery1.AllItems table and was able to extract the path with a little bit of massaging. My pictures are stored in my OneDrive (and referenced from an Excel file, also the default behavior of the Site Inspections template), so I just include that in my path directory. The path may be different than yours, but you should be able to locate the images that get uploaded depending on what you're using. Here's the snippet of code that I used:

 

Concat(Gallery1.AllItems,
"<img src='https://company-my.sharepoint.com/personal/my_name_email_com/Documents/PowerApps/Templates/"
& Substitute(Mid(Photo, Find("SiteInspection",Photo)), "%252f", "/") & "' />"
)

 

You should be able to use this code and just substititute the path at the begining that is bolded to point to your directory. 

 

What this does is takes the Photo from each row and parses out the path we need, starting at SiteInspection, which is part of the directory name, we then substitute '%252f' with a forward slash '/' so the path is readable by the img src. This allows us to display the image on our HtmlText control. I needed this to show up because I was trying to convert that HtmlText to a PDF, however, that portion doesn't work yet, but the images can definitely be displayed.