Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
FormattedLinkEditor - data uris supported?
posted

I'd like to show images provided as data-uris (just like documented here: https://de.wikipedia.org/wiki/Data-URL ).

Unfortunately, it seems like this format isn't provided - or did I do something wrong?

My (test) value is:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC" />
  • 469350
    Offline posted

    No, data Uris are not supported. But you can embed an image as a base64 string using the data tag. 
    The encoding seems to be slightly different. The string you have here for the data works in html, but not for the UltraFormattedTextEditor, so you probably need to re-encode it in Visual Studio. There are a couple of ways to do this. One is to do it in code: 

    Image image = Images.FromFile(myImageFile);
    string encodedImage = this.ultraFormattedTextEditor1.EditInfo.EncodeImage(image);
    this.ultraFormattedTextEditor1.EditInfo.InsertValue(String.Format("<img data=\"{0}\" />", encodedImage));

    Another option is to use do it at design-time and go to the Value property of the UltraFormattedTextEditor and click the Insert Image button and then select the image file and check the "Embed Image Data in Xml" checkbox.