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 / Save Image format chan...
Power Apps
Answered

Save Image format changed from camera control?

(0) ShareShare
ReportReport
Posted on by 69

Hi Expertise,

 

Recently i am facing an issue while saving the image as attachment in CRM captured by camera control from canvas app .

 

I saves the imag as jpeg format to collection from camera control. As camera control gives the URL as base64 string of captured image with the prefix “data:image/jpeg;base64,”. so, i replaced initial string with ""(blank) and saved into the CRM . the record has been saved but while opening the attachment from CRM ,it gives below error 

 

powerapp error1.png

 

After digging more, i found that the base 64 string of saved image from the camera control was like "/png" as shown below and not the "/jpeg" and i was replaing the initial string by considering it as "/jpeg",

powerapps image saved.png

In CRM these attachments are stored as jpg type as below:

 

pwoerapps saved images.png 

 

I followed the same steps earlier(before recent update) also but at that time i didn't face such issue.

 

can anyone of you let me know why this behaviour of mismatching of base64 string is happening after the recent updated of powerapps?

 

thanks in advance.

Categories:
I have the same question (0)
  • Verified answer
    v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Dexx3336,

     

    Just from the error message, it told that the base64 string contains invalid characters.

    "The input is not a valid base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. "

     

    Have you tried to save the image directly without doing any modification?

    The image saved from the camera control could be saved directly to the image field of the CRM entity.

     

    Besides, take a look at the following blog for how to "link" Image in CDS into Dynamics 365:

    PowerApps - Working with Images Part 1

    Part 2

     

    Regards,

    Michael

  • Dexx3336 Profile Picture
    69 on at

    Thanks, @v-micsh-msft for a response.

     

    I can not save the image captured from camera control directly to the CRM as it appends some string at its prefix like belowpowerapps image saved.pngMy requirement is to store the captured images as attachments in notes entity against OOB/custom entities so I have to replace unwanted string to store in notes.

     

    Earlier i was getting "data:image/jpeg;base64," and now i am getting "data:image/png;base64,"unwanted string.

    So I  used below code to replace the unwanted string. 

    If(StartsWith(First(Image).fileBody,”data:image”),Replace(First(Image).fileBody,1, Len(Left(First(Image).fileBody,Find(“,”,First(Image).fileBody))),””),First(Image).fileBody)});
    The conversion of unwanted string is resolved using above code. But now i stuck at another issue: Not able to create the attachment regarding any entity

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,045

#2
Valantis Profile Picture

Valantis 675

#3
11manish Profile Picture

11manish 592

Last 30 days Overall leaderboard