Images with spaces in the filename are not displayed

2 posts, 0 answers
  1. Laura Edwards
    Laura Edwards avatar
    25 posts
    Member since:
    Jun 2010

    Posted 11 Mar 2011 Link to this post


    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.
        _imageGallery = null;

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

    Any help would be appreciated.
  2. Boby
    Boby avatar
    636 posts

    Posted 17 Mar 2011 Link to this post

    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.

    the Telerik team
Back to Top