Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

How I get an "Add Picture With Image" button to work?

Posted on by 8
I'm very new to Power Apps. I'm trying to populate a screen with data from a collection variable. The picker button works for the most part. I want to load the Image with the image in the collection. I tried this:
If( Not IsBlank(AddMediaButton1.Media), AddMediaButton1.Media, Not IsBlank(StepsView.Selected.Photo),StepsView.Selected.Photo, SampleImage)
This has an error that the statement is not returning an Image. The error is "Expected Image Value". However, these variations, which don't work, don't have errors:
If( Not IsBlank(AddMediaButton1.Media), AddMediaButton1.Media, SampleImage) // No Photo
If(  Not IsBlank(StepsView.Selected.Photo),StepsView.Selected.Photo, SampleImage) // No Media
I have no control of the Button.Media. I can't set it, I can "Reset" it. Can I change "Photo" to something compatible with Media?
 
  • RM-13111543-0 Profile Picture
    RM-13111543-0 8 on at
    How I get an "Add Picture With Image" button to work?
    So,
    Solved it. I had to add a delay into the OnChange in the Button. I stored the image into the collection before it actually changed, So I was getting the SampleImage or an old image. Seems to be working now.

    Thank you for the replies!
  • ronaldwalcott Profile Picture
    ronaldwalcott 1,167 on at
    How I get an "Add Picture With Image" button to work?
    If you are seeing the image what is the purpose of the code that you are adding?
    Do you want to display something in particular if there isn't an image, or load an image?
    What functionality are you trying to add?  
  • timl Profile Picture
    timl 32,058 on at
    How I get an "Add Picture With Image" button to work?
     
    Hi RM-13111543-0
     
    Can you clarify where you're calling this formula, and perhaps post the code you're using to build the collection?
     
    With regard to the "Expected Image value" error, the control should include an image control (it'll be named something like UploadedImage1). If you reference this instead, that should hopefully return an image value.
     
    If( Not IsBlank(AddMediaButton1.Media), UploadedImage1.Image, SampleImage)
     
  • RM-13111543-0 Profile Picture
    RM-13111543-0 8 on at
    How I get an "Add Picture With Image" button to work?
    Yes, and I see the selected image when I push it to a List with a "Collect".
  • ronaldwalcott Profile Picture
    ronaldwalcott 1,167 on at
    How I get an "Add Picture With Image" button to work?
    Assuming StepsView is your gallery with the collection set as your items.
    If you use 
    StepsView.Selected.Photo
    in your image control are you seeing a photo?

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard