Skip to main content

Notifications

Business Central forum
Suggested answer

Converting base64 to image using blob field

Posted on by 382

hello everyone, 

How can I convert base64 to image using Blob field. Can someone provide me the code for it.?

Categories:
  • Dharmendra_Chavda Profile Picture
    Dharmendra_Chavda 101 on at
    Converting base64 to image using blob field
    Hello

    try this
     
  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 20,995 Moderator on at
    RE: Converting base64 to image using blob field

    hi,

    Can you try this?

                var
                    Media: Record "Tenant Media";
                    Base64: Codeunit "Base64 Convert";
                    Mime: Text;
                    instr: Instream;
                begin
                    Clear(output);
                    Clear(Media);
                     if Media.get(mediafield.MediaId) then BEGIN
                         Media.CalcFields(Content);
                         if Media.Content.HasValue then begin
                             Clear(instr);
                             Media.Content.CreateInStream(instr, TextEncoding::WINDOWS);
                             output := Base64.ToBase64(instr);
                         end;
                     end;
                    

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,186 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 227,996 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans