- Home
- Forum
- ASP.NET MVC - EJ 2
- Image Crash
Image Crash
Good night,
Attachment: chrome_axG7kaiHqD_4eae1fd1.zip
I`m trying to paste a text with image on a RTE, but i tried all examples and it does not work in my application test, only in a demo page.
I have to paste the test with image inside from word and save all like a text using image base64 on database, thats my code, that i found here on forum.
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; } @using Syncfusion.EJ2.Navigations; @using Syncfusion.EJ2; @using Syncfusion.EJ2.Popups; @using Syncfusion.EJ2.DropDowns; <div class="control-section"> <div class="control-wrapper"> <div class="control-section"> @Html.EJS().RichTextEditor("default").Value((string)ViewBag.value).ActionComplete("actionComplete").Render() </div> </div> </div> <script> function actionComplete(args) { if (args.requestType == "Image") { imgelement = args.elements[0]; toBase64(imgelement.src, function (dataUrl) { imgelement.setAttribute('src', dataUrl) }) } } function toBase64(url, callback) { var httpRequest = new XMLHttpRequest(); httpRequest.onload = function () { var fileReader = new FileReader(); fileReader.onloadend = function () { callback(fileReader.result); } fileReader.readAsDataURL(httpRequest.response); }; httpRequest.open('GET', url); httpRequest.responseType = 'blob'; httpRequest.send(); } </script> <style> .e-richtexteditor .e-rte-srctextarea { max-width: none; } </style>
Attachment: chrome_axG7kaiHqD_4eae1fd1.zip
SIGN IN To post a reply.
1 Reply
1 reply marked as answer
PM
Pandiyaraj Muniyandi
Syncfusion Team
July 21, 2020 08:39 AM UTC
Greetings from Syncfusion support.
We have validated your query and the saving image as base64 format feature included in Rich Text Editor from version 17.2.0.41. This is will resolve the reported issue from your end.
Now you can enable this functionality by configuring SaveFormat API as Base64 in InsertImageSettings API as follows
|
@Html.EJS().RichTextEditor("RTE").InsertImageSettings(obj => obj.SaveFormat(Syncfusion.EJ2.RichTextEditor.SaveFormat.Base64)).Render()
|
We have prepared sample for your reference, get it from below link
Can you confirm whether above shared sample meets your requirement?
Note: Generally, base64 string not suitable for larger size image, it will crash the web page.
Regards,
Pandiyaraj
Marked as answer
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
- Marked answer
-
FB Fillipe Barbosa
- Jul 21, 2020 01:10 AM UTC
- Jul 21, 2020 08:39 AM UTC