web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Displaying image using...
Power Apps
Unanswered

Displaying image using 64base

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello!

I have a ticket system application where they can add a picture. This picture gets saved to my SharePoint list using this code: 

Patch(
 'Foto''s Manco App',
 Defaults('Foto''s Manco App'),
 {Title: DataCardValue12.Text & " " & DataCardValue24.Text,
 ImageData: Substitute(JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData),"""","")
 }
)

 It looks like this: https://gyazo.com/5c8b7dcb733b60d00e54b47038f592c2

I use: "AddMediaButton1.Media" to get the picture into the "UploadedImage1"

I then made a formula that would display the image but this does not seem to work anymore. 

LookUp('Foto''s Manco App', Title= DataCardValue12.Text & " " & DataCardValue24.Text, ImageData)

I used this formula instead of "AddMediaButton1.Media", this code would check if there is a picture in the database, if there is not, get the picture using "AddMediaButton1.Media"

Code: 

If(LookUp('Foto''s Manco App', Title= DataCardValue12.Text & " " & DataCardValue24.Text, ImageData)= "", AddMediaButton1.Media, LookUp('Foto''s Manco App', Title= DataCardValue12.Text & " " & DataCardValue24.Text, ImageData))

 

How could I do this?

 

Categories:
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous :

    Please try this code:

    UploadedImage1.Image:

     

    If(IsBlank(AddMediaButton1.Media),If(IsBlank(ThisItem.ImageData),SampleImage,ThisItem.ImageData), AddMediaButton1.Media)

     

    AddMediaButton1.Text:

     

    If(IsBlank(ThisItem.ImageData),"Tap or click to add a picture","Tap or click to change the picture")

     

    5.gif

    If your issue is resolved, please mark a valid response as solution,thank you.

    Best Regards,

    Bof

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Instead of SampleImage I have used my LookUp formula, this has worked. However, when I edit a ticket and want to change the image, this does not work. Do you know why? @v-bofeng-msft 

     

    I have to change another field, when that happends, it will change the picture too, how come?

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous :

    This problem is caused by logic error,you need to first determine whether there is a value in AddMediaButton1.Media.

     

    If(IsBlank(AddMediaButton1.Media),If(LookUp('Foto''s Manco App', Title= DataCardValue12.Text & " " & DataCardValue24.Text, ImageData)= "", AddMediaButton1.Media, LookUp('Foto''s Manco App', Title= DataCardValue12.Text & " " & DataCardValue24.Text, ImageData)),AddMediaButton1.Media)

     

    Best Regards,

    Bof

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I have tried it, it does change the picture but whenever I save it, I think it does not delete the old one and simply puts a new one in there, but it takes the first picture first in the list @v-bofeng-msft 

    Edit:

    yes, this is indeed what is happening. Proof: https://gyazo.com/fe2cfa2dea17d60054969731a7d3f3be

    So somehow we need to delete a picture if there already was one on the onsuccess of the form? The Title column is based off this: 

    Bestandsnaam space ticket id

    Maybe we could use the auto ID that comes with every row? We could say always take the last ID of that Title

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous :

    Because the function of the path ()XX formula you use is to add a new record.

    You need to adjust your code according to different needs,If you need to modify the record, please try this following code:

     

    Patch(
     'Foto''s Manco App',
     ThisItem,
     {Title: DataCardValue12.Text & " " & DataCardValue24.Text,
     ImageData: Substitute(JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData),"""","")
     }
    )

     

    since your control is already in a form,I suggest you consider using the submitfrom function.

    just set the imagedata datacards's update propery to:

     

    Substitute(JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData),"""","")

     

     Best Regards,

    Bof

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I get an error using this code instead of the code I used, is it not possible to let it show the image with the highest ID?:

     

     

    Patch(
     'Foto''s Manco App',
     ThisItem,
     {Title: DataCardValue12.Text & " " & DataCardValue24.Text,
     ImageData: Substitute(JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData),"""","")
     }
    )

     

     

    Error: https://gyazo.com/91fe4be9a4bcd3c4e84bd82c838831cf

    Getting this error trying your second code: https://gyazo.com/680532528dddcf33272d9c8dac2dc255

    So we could edit the LookUp formula to always look for the highest ID? 

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous :

    Yes.

    Please try:

    Patch(
           'Foto''s Manco App',
           First(Sort('Foto''s Manco App',ID,Descending)),
           {Title: DataCardValue12.Text & " " & DataCardValue24.Text,
             ImageData: Substitute(JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData),"""","")
           }
    )

    Best Regards,

    Bof

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Worked once, doesn't work anymore. @v-bofeng-msft 

    We might still need to change the LookUp formula to show the latest picture 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    What could I change the LookUp formula to? @v-bofeng-msft 

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous :

    The following are my detailed steps:

    My data source:MyPhoto

    Title-text

    Photo-mutiple lines of text

    1\add a form(Form2);

    DataSource:

     

    MyPhoto

     

    Item:

     

    Gallery1.selected

     

    2\photo data card

    Update:

     

    var /*Var is my custom variable*/

     

    3\add a addpicture control into photo data card

    Image:

     

    If(IsBlank(AddMediaButton1.Media), If(IsBlank(ThisItem.Photo),SampleImage,ThisItem.Photo), AddMediaButton1.Media)

     

    4\Add a Button:

    OnSelect:

     

    Set(var,Substitute(JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData),"""",""));SubmitForm(Form2);Refresh(MyPhoto)

     

    6.gif

    Best Regards,

    Bof

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard