cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
langsem
Post Patron
Post Patron

Encode base64

Hello i have an application where i upload multiple images with powerapps and power automate to a server. The server requires base64 plane text ( just the base64 value ) how can this be done in power apps and power automate ? The images has also nametag, timestamp and are stored in a collection before shipped of to power automate for then to be posted to server. 

26 REPLIES 26

Hi @langsem ,

 

First, move the collect formula to OnChange property of DMG_SCHEME_BTN, rather than OnSelect property, and modify it as follows.

Collect(imgCol;({Name:"Skademelding.jpeg"; Image:DMG_SCHEME_IMG.Image; timeStamp: Now()}))

This is because  DMG_SCHEME_BTN.Media store the temporary blob URL of the image, but the DMG_SCHEME_IMG.Image store the binary file of image.

Then set the OnSelect of Send button:

ClearCollect(colBase64;DropColumns(AddColumns(colImg;"Base64";Mid(JSON(Image;JSONFormat.IncludeBinaryData);25;Len(JSON(Image;JSONFormat.IncludeBinaryData))-25));"Image"));;
Set(JsonCol;JSON(colBase64;JSONFormat.IncludeBinaryData));; IMG_API.Run(SONR;reg;Jobbtype;FORSIKRING;JsonCol)

 The Text of Label: 

Last(colBase64).Base64

 

Here are my test result:Snipaste_2020-10-07_10-04-28.pngSnipaste_2020-10-07_10-04-46.png

Sik

 

When changing to onchange trigger i get the same error when using .image. Shall i put the aciton on the image itself or the btn ?

Hi @langsem ,

 

Ensure it is DMG_SCHEME_IMG.Image.  (ImageControlName.Image)

The code must be put on the OnChange event of DMG_SCHEME_BTN

Sik

Yes found it out, but format its wrong 😞 so not sure if its throwing just the base64 value

Found the issue it was missing a / at start. how can i include it ?

Hi @langsem ,

 

Please check the Mid formula which is used for extracting the base64 string. change 25 to 24 to see if it works?

Mid(JSON(Image;JSONFormat.IncludeBinaryData);24;Len(JSON(Image;JSONFormat.IncludeBinaryData))-24)

 Sik

View solution in original post

could i ask, is it possible to save the image url also? and convert it to jpg even tho its a png ?

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,974)