More in this section

Forums / Developing with Sitefinity / Image selector don't display image

Image selector don't display image

4 posts, 0 answered
  1. Krishna
    Krishna avatar
    8 posts
    Registered:
    05 Sep 2008
    18 Nov 2009
    Link to this post
    Hi,

    I have an image selector to select the image to be displayed on the page. When the image inserted from the file system, it correctly displays that image. Where as when I select the image from the Libraries, the image is not displayed. Please suggest me the fix for this.

    I'm using Sitefinity 3.6

    thaks & regards
    Krishna
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 Nov 2009
    Link to this post
    Hi Krishna,

    Which image selector you use? Some of the built-in or you have a custom control? when you observe the link with browser development add on is the link correct or broken somehow?

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Krishna
    Krishna avatar
    8 posts
    Registered:
    05 Sep 2008
    18 Nov 2009
    Link to this post
    Hi Ivan,

    Thanks for the quick reply. What I'm using is a user control which consists of an image control. I defined a property with ImageSelector attribute. It works fine when I select image from the file system, but not from the library. When I see the properties for the image it shows GUID.

    I hope this information will be useful to diagnose the issue

    Thanks & regards
    Krishna
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 Nov 2009
    Link to this post
    Hi Krishna,

    You need to resolve the Guid by getting the content item object from the value ( the Guid is the Id of the IContent object). Generally you need to pass this ID to LibraryManager and get the IContent UrlWithExtension.

    Sample:

    IContent cnt = ContentManager.Providers[value].GetContent(id);
                    if (cnt != null)
                       return VirtualPathUtility.ToAbsolute(cnt.UrlWithExtension, this.Context.Request.ApplicationPath);

    More information at how to resolve dynamic links

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered