November Happy Hour will be moved to Thursday December 5th.

Converting base64 images to files "for this page" programmatically

Vote:
 

Hello,

I'm importing content into Optimizely CMS from an external system. Saving the pages with the external content works fine, but the images are in a base64  "<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgAB ..." format.

When I open a rich text field in Optimizely with such an image, in TinyMCE, the image is automatically saved to "For this page", and the image src is now an url to a regular file on the server.

How can I automate this process, so all image are converter from base64 string to file during the import process, without having to go into TinyMCE in the generated page? 

#293146
Dec 14, 2022 14:11
Vote:
 
#293386
Dec 19, 2022 13:02
Vote:
 

Hello Praful,

I've developed a solution in code. The code you refer to is certainly part of that solution. The solution was a bit elaborate, because you have to find the images in the Xhtml string with the HTML Agility Pack, and then replace the source attribute with the url of the image you have previously saved "for this page" etc. 

#293389
Dec 19, 2022 13:18
Praful Jangid - Dec 19, 2022 13:39
Oh, I didn't notice you have image as part of raw markup.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.