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

Images with spaces in the filename are not displayed

1 Answer 26 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Laura Edwards
Top achievements
Rank 1
Laura Edwards asked on 11 Mar 2011, 09:56 PM
Hello,

We've run into the issue where if the image we are adding to the html has spaces in the name, it is not being displayed. It displays fine when I right after I insert it from our image gallery but as soon as I save it to our database and then switch the html editor to readonly the image is not displayed. It works just fine for images without spaces in the filename.

Here is a same of the code we use for inserting the image:
private void InsertImage(string filename)
{
    var user = WebContext.Current.User;
 
    ImageInline image = new ImageInline();
    image.UriSource = new Uri(string.Format(FilenameToBitmap.GetImageGalleryUriFormat(), user.BrokerId, filename));
    image.Extension = IOAlias.Path.GetExtension(filename);
 
    // Insert the image at current caret position.
    editor.InsertInline(image);
 
    _imageGallery.Close();
    _imageGallery = null;
}

The UriSource when formatted has %20 in place of the spaces.

Any help would be appreciated.

1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 17 Mar 2011, 02:21 PM
Hi Laura Edwards,

Sorry for the delay, but we were busy with Q1 version release.
I am not sure if I understand your scenario correctly, but we did not manage to reproduce the issue. There are several factors however that can affect showing of the images:
  • the way you save your document to HTML - if you want to preserve uri sources you have to set ImageExportMode to URI source (there is sample in the demo project)
  • Cross-domain policy - you can show images only from current domain or domains that authorized you, you can read more here
I have prepared a simple demo project (find attached), that demonstrates showing of images with %20 in their URI source.

If this doesn't help, you can open a support ticket and send us a sample project that demonstrates the problem.

Greetings,
Boby
the Telerik team
Tags
RichTextBox
Asked by
Laura Edwards
Top achievements
Rank 1
Answers by
Boby
Telerik team
Share this question
or