cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

JSON and JPEG's

Hello,

I'm adapting @Shanescows tutorial here to send multiple images to Flow using the JSON function. This worked great until recently. After some troubleshooting, it appears that PowerApps is encoding all images taken from my iPhone as JPEG's where as before I'm fairly certain they were PNG's.

JPEG's aren't being converted in Flow correctly because of the Mid function.

Examples:

PNG's:

image.png

JPEG's:

image.png

Does anyone know where the base64 begins in a JPEG string?
THanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: JSON and JPEG's

Wahoo! Got it!

Basically:

 

If(
    Right(btnUpload.FileName, 3) = "jpg",
        Mid(varJson, 25, Len(varJson) - 25),
    Right(btnUpload.FileName, 3) = "png",
        Mid(varJson, 24, Len(varJson) - 24)
)

 

 

View solution in original post

4 REPLIES 4
Super User
Super User

Re: JSON and JPEG's

Wahoo! Got it!

Basically:

 

If(
    Right(btnUpload.FileName, 3) = "jpg",
        Mid(varJson, 25, Len(varJson) - 25),
    Right(btnUpload.FileName, 3) = "png",
        Mid(varJson, 24, Len(varJson) - 24)
)

 

 

View solution in original post

Super User
Super User

Re: JSON and JPEG's

Hm...bummer. This gets the Flow to work, but neither PNG nor JPEG images show up correctly in Sharepoint. Does anyone have some troubleshooting ideas for this? 
To recap:

  • I'm peeling off 24 or 29 characters from the JSON in the PowerApp depending on .png vs. jpg
  • Sending this to Flow (base64toBinary() )
  • Flow successfully runs and Creates File in Sharepoint
  • Sharepoint does not show the images ("Download" doesn't work either.)

Thanks!

 

image.png

 

image.png

Community Support
Community Support

Re: JSON and JPEG's

That' wonderful.

Best regards,

Sik

Super User
Super User

Re: JSON and JPEG's

Figured out what my second issue was...

My UI/UX is multi-step. There was a second place in my app where I was applying the Mid() statement (thus pulling off too many characters and making the Base64 invalid). I removed the second Mid() statement and now the images (BOTH JPG and PNG) are coming through fine!

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (7,344)