Skip to main content
1-Visitor
June 26, 2018
Solved

Convert image to base64

  • June 26, 2018
  • 1 reply
  • 3866 views

How can I convert a image (media entry) to an base64 code?

Best answer by drichter

I solved it. I create a function with return type BLOB and this line:

 

var result = MediaEntities[image].GetImage();

1 reply

22-Sapphire I
June 26, 2018

You can look into using the snippet:

var encodedValue = base64EncodeBytes(undefined /* not ready for baseType of "JSON" yet*/);

drichter1-VisitorAuthor
1-Visitor
June 27, 2018

I know this function but i believe its not work with MediaEntities.

 

EDIT: Maybe I need a step that convert the image to an byte array

drichter1-VisitorAuthorAnswer
1-Visitor
June 27, 2018

I solved it. I create a function with return type BLOB and this line:

 

var result = MediaEntities[image].GetImage();