We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to save images as base64 string

Is it possible to save images as a base64 string with the rest of the text? When I get the value of the text it is showed and stored a link.

3 Replies

PO Prince Oliver Syncfusion Team April 2, 2019 01:06 AM

Hello Toko, 

Thank you for contacting us. 

Query 1: “Is it possible to save images as a base64 string with the rest of the text?” 

Yes. It is possible to save images as a base64 string with the rest of the text. By default, we have created a blob URL for the image and set to the src property of <img> tag. We have prepared a sample to convert the blob URL of inserting images to base64 in the Rich Text Editor component. 


The above sample covered the below things, 
  • Converted the image source URL through an ActionComplete event of Rich Text Editor and set the base64 result as a source attribute of inserting image using onloadend FileReader event.
  • The readAsDataURL method is used to read the contents of the specified Blob or File.
  • The onloadend event triggered each time the reading operation is completed.


Query 2: “When I get the value of the text it is showed and stored a link.” 

We could not fully get your above-mentioned requirement. We need additional information on this. Could you please share the below details? 

  • Do you get the value of the Rich Text Editor component?
  • Do you show the insert image source attribute as base64 string when the source code button is clicked?
  • Can you please share the clear information about your requirement? This will help us provide a prompt solution.

Regards, 
Prince 



RV Roy van Es April 3, 2019 01:48 PM

Exactly what I was looking for, thanks!


PO Prince Oliver Syncfusion Team April 3, 2019 08:23 PM

Hello Toko, 

Most welcome. We are glad to help you. 

Regards, 
Prince 


Loader.
Live Chat Icon For mobile
Up arrow icon