I have an html file with <img src="./images/ForkliftGateMainPage.png" alt="MainPage" width="1600" title="Page principale" />
The image is displayed when I open it with my browser, but not displayed with RadRichtextEditor, Why ?
7 comments
ADMIN
Didi
Posted on:04 Jan 2024 13:37
Hello Legrand,
I think there is a misunderstanding. Maybe I didn't explain it clear. You can insert images in the editor from a file on the device. Here is more information for working with images: https://docs.telerik.com/devtools/maui/controls/richtexteditor/working-with-images/overview for example when you insert and image from the device to the RichTextEditor by using the exposed toolbar item, Internally we convert this image to base64 sting and include it in the editor (we do not include the path on the device). If you export the file and check the html code you will notice the image is base64 string.
The project I attached in previous replies uses path to the image added to the Raw folder in the project (here the challenge is to find the correct path - this is outside of the RichTextEditor scope)There isn't an option to pass a path in the html file that leads to an image on the device.
The behavior is related to an incorrect file path. If you pass the correct file path the image will be displayed. Similar to the example I shared in my previous reply.
I have logged an internal item for a research whether another option for displaying images could be provided. For now the options you can use are described in my previous post.
I could display my image with base64 (on Windows PC)
This mean we have to modify our documents, in order to change all the relative path to Base64. This is not really convenient.
As I understood the problem is with the webview, and we can't do anything, right ?
ADMIN
Didi
Posted on:04 Jan 2024 07:03
Hello Legrand,
You have the following options to set images in the html file:
As base64 string, URI and file (if you know the correct file path, then the image will be displayed) This <img src="./images/ForkliftGateMainPage.png" is not a correct path. The image could be on this location in the project but actually it is not a correct file path for the image to be displayed. I have attached a project where the image is added inside the Resources/Raw folder. The html file is added to the project as embedded resources and the correct file path to the image on Android is:
<imgsrc="file:///android_asset/bot1.png"/>
You can also convert the images to a base64 string then add the string to img src to the html file.
I have changed the bug report status to Declined, as it is not a valid bug report. The behavior is related to the correct file path.