This is a migrated thread and some comments may be shown as answers.

RadEditor render embedded image issue

1 Answer 82 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Hetal
Top achievements
Rank 1
Hetal asked on 05 Nov 2008, 04:13 AM
Hello,

I have a mail message file whose content is html and which has an embedded image inside it.

I need to display the content along with the embedded image inside RadEditor.

I set the content property of RadEditor to the appropriate html but the embedded image is not rendered.

Code is as follows:

//Get HTML Content for RadEditor
string content =
"<html xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:w=\"urn:schemas-microsoft-com:office:word\" xmlns=\"http://www.w3.org/TR/REC-html40\">\r\n\r\n<head>\r\n<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=us-ascii\">\r\n<meta name=Generator content=\"Microsoft Word 11 (filtered medium)\">\r\n<!--[if !mso]>\r\n<style>\r\nv\\:* {behavior:url(#default#VML);}\r\no\\:* {behavior:url(#default#VML);}\r\nw\\:* {behavior:url(#default#VML);}\r\n.shape {behavior:url(#default#VML);}\r\n</style>\r\n<![endif]-->\r\n<style>\r\n<!--\r\n /* Font Definitions */\r\n @font-face\r\n\t{font-family:Calibri;\r\n\tpanose-1:2 15 5 2 2 2 4 3 2 4;}\r\n /* Style Definitions */\r\n p.MsoNormal, li.MsoNormal, div.MsoNormal\r\n\t{margin:0in;\r\n\tmargin-bottom:.0001pt;\r\n\tfont-size:12.0pt;\r\n\tfont-family:\"Times New Roman\";}\r\na:link, span.MsoHyperlink\r\n\t{color:blue;\r\n\ttext-decoration:underline;}\r\na:visited, span.MsoHyperlinkFollowed\r\n\t{color:purple;\r\n\ttext-decoration:underline;}\r\nspan.EmailStyle17\r\n\t{mso-style-type:personal-compose;\r\n\tfont-family:Arial;\r\n\tcolor:windowtext;}\r\n@page Section1\r\n\t{size:8.5in 11.0in;\r\n\tmargin:1.0in 1.25in 1.0in 1.25in;}\r\ndiv.Section1\r\n\t{page:Section1;}\r\n-->\r\n</style>\r\n<!--[if gte mso 9]><xml>\r\n <o:shapedefaults v:ext=\"edit\" spidmax=\"1026\" />\r\n</xml><![endif]--><!--[if gte mso 9]><xml>\r\n <o:shapelayout v:ext=\"edit\">\r\n  <o:idmap v:ext=\"edit\" data=\"1\" />\r\n </o:shapelayout></xml><![endif]-->\r\n</head>\r\n\r\n<body lang=EN-US link=blue vlink=purple>\r\n\r\n<div class=Section1>\r\n\r\n<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;\r\nfont-family:Arial'><o:p>&nbsp;</o:p></span></font></p>\r\n\r\n<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;\r\nfont-family:Arial'><img width=341 height=308 id=\"_x0000_i1027\"\r\nsrc=\"cid:image001.jpg@01C93E02.75EFB430\"><o:p></o:p></span></font></p>\r\n\r\n<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;\r\nfont-family:Arial'><o:p>&nbsp;</o:p></span></font></p>\r\n\r\n<p class=MsoNormal><strong><b><font size=3 face=Calibri><span style='font-size:\r\n12.0pt;font-family:Calibri'>William Upshaw</span></font></b></strong><o:p></o:p></p>\r\n\r\n<div>\r\n\r\n<p class=MsoNormal><font size=2 face=Calibri><span style='font-size:10.0pt;\r\nfont-family:Calibri'>Senior Consultant</span></font><o:p></o:p></p>\r\n\r\n</div>\r\n\r\n<div>\r\n\r\n<p class=MsoNormal><font size=2 face=Calibri><span style='font-size:10.0pt;\r\nfont-family:Calibri'>Allin Consulting</span></font><o:p></o:p></p>\r\n\r\n</div>\r\n\r\n<div>\r\n\r\n<p class=MsoNormal><font size=2 face=Calibri><span style='font-size:10.0pt;\r\nfont-family:Calibri'>404.353.7782 (mobile)</span></font><o:p></o:p></p>\r\n\r\n</div>\r\n\r\n<div><span title=\"http://www.allin.com/\">\r\n\r\n<p class=MsoNormal><font size=3 face=\"Times New Roman\"><span style='font-size:\r\n12.0pt'><o:p>&nbsp;</o:p></span></font></p>\r\n\r\n</div>\r\n\r\n<div>\r\n\r\n<p class=MsoNormal><font size=3 face=\"Times New Roman\"><span style='font-size:\r\n12.0pt'>&nbsp;</span><o:p></o:p></font></p>\r\n\r\n</div>\r\n\r\n<p class=MsoNormal><font size=3 face=\"Times New Roman\"><span style='font-size:\r\n12.0pt'><o:p>&nbsp;</o:p></span></font></p>\r\n\r\n</div>\r\n\r\n</body>\r\n\r\n</html>\r\n\r\n"

//Set RadEditor Content
radEditor.Content = content;

Regards,
Hetal.

 

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 10 Nov 2008, 08:13 AM
Hi Hetal,

The image tag that you are loading in RadEditor (<img width=341 height=308 id=\"_x0000_i1027\"\r\nsrc=\"cid:image001.jpg@01C93E02.75EFB430\">) has the following invalid web path

src="cid:image001.jpg@01C93E02.75EFB430", which the browser cannot find and render. If you load this content in a standard html or aspx page without RadEditor on it, you will experience the same problem, because this the image src path is not accessible via HTTP.

In order to use images, they need to be accessible via the HTTP protocol - that is, it means they must be uploaded to a web server.

You can use the editor to upload images FROM the user (someone using the editor)  TO the web server.  By default, the editor toolbar includes an image tool which brings up a dialog to select an existing image or to upload an image from the client to the server. You can test this functionality in the following example: File Managers.

Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Hetal
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or