Skip to main content
1-Visitor
Jun 26, 2018 12:54 PM UTC
Solved

Convert image to base64

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

drichterAnswer
1-Visitor
Jun 27, 2018 11:09 AM UTC

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

 

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

3 replies

22-Sapphire I
Jun 26, 2018 2:31 PM UTC

You can look into using the snippet:

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

Translate
drichter1-VisitorAuthor
1-Visitor
Jun 27, 2018 7:24 AM UTC

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

Translate
drichter1-VisitorAuthorAnswer
1-Visitor
Jun 27, 2018 11:09 AM UTC

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

 

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