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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to pass a picture ...
Power Apps
Unanswered

How to pass a picture to Power Automate (v2)

(0) ShareShare
ReportReport
Posted on by 15

I use to pass a picture to Power Automate with this code, placed on a OnTimerEnd statement:

 

ClearCollect(Pic1; {Photo: Camera1_1.Stream; time: Now()});;

ClearCollect(colFaceData1; StarliveFaceAPI_v1.Run("Image1.jpg"; First(Pic1).Photo));;

 

In the new Power Automate (V2) I tried in several ways to get the picture in Power Automate. I used a text input and I used a File input, but in both ways the body did no pass. The best I got was using this code and a use a text input in the PowerApps(v2)

 

ClearCollect(Picture; Camera1_1.Stream);;

Set(Pic1Raw;
JSON(First(Picture);JSONFormat.IncludeBinaryData)
);;
Set(Pic1_64;
Mid(Pic1Raw; 24;Len(Pic1Raw) - 24)
);;

StarliveFaceAPI_v1_test.Run(Pic1_64)

 

I did not get any result back. Can someone tell me

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,030 Most Valuable Professional on at

    Hi @HenkVlootmN ,

    Assuming you are setting the file name in the Flow and using base64ToBinary to get the JSON back to a file format, try this

    With(
     {
     _JSON: 
     With(
     {
     _JSONI: 
     JSON(
     Camera1_1.Stream,
     JSONFormat.IncludeBinaryData
     )
     },
     Mid(
     _JSONI,
     Find(
     ",",
     _JSONI
     ) + 1,
     Len(_JSONI) - 
     Find(
     ",",
     _JSONI
     ) - 1
     )
     )
     },
     StarliveFaceAPI_v1_test.Run(
     _JSON,
     )
    )

    However, you should be able to pass the file content directly using Power Apps V2 (although I have never tried a Camera Stream)

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • HenkVlootmN Profile Picture
    15 on at

    Hi @WarrenBelz ,

     

    Thank you for this nice solution.  For other viewers who want to try this script: there is one missing bracket at the end of the script and, since I do not have an extra argument in the .run argument, I deleted the comma.

     

    But although it looks like a good solution it does not returns the any value. I just passed it directly to the HTTP step in Power Automate, since the REST API I trigger accepts a base64 output. This is the error result:

     

    HenkVlootmN_0-1699266256942.png

    I saw a video of Shane Young PowerApps upload file to SharePoint document library - YouTube and it appears that this solution only works if you use the .image argument. I do not get any results with the .stream and .photo from the camera triger and .image argument does not work. 

    I never worked with the "WIth" statement in PowerApps, but it looks like a good way to build formula's :-).

  • WarrenBelz Profile Picture
    153,030 Most Valuable Professional on at

    @HenkVlootmN ,

    Bracket corrected (dangers of free-typing Text).

    If you set an Image control to the Camera Stream, you should be able to use JSON on that.

  • Verified answer
    HenkVlootmN Profile Picture
    15 on at

    I finaly got it working with this code. Getting the contents in a collection made it work. I'll use a Compose in Power Automate to get the results I want.

     

    ClearCollect(
    _JSONTest;
    {
    Base64String:
    JSON(Camera1.Photo; JSONFormat.IncludeBinaryData)
    }
    )

    ;;
    Set(_JSON;Last(_JSONTest).Base64String)
    ;;
    StarliveFaceAPI_v1_test.Run(_JSON)

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard