Try Now
More in this section

Forums / Developing with Sitefinity / change in sfref value causes to image to fail?

change in sfref value causes to image to fail?

2 posts, 0 answered
  1. Will
    Will avatar
    1 posts
    15 Apr 2011
    15 Apr 2011
    Link to this post
    I had an image in a resource that was displaying fine - it had a sfref value that seemed to be a hexadecimal code:

    something like :
    <img src="/assets/soletrader/libraries/general/myimage.png" sfref="[Libraries] 12345ABCD-1234AD" href="/imagelink" alt="imagealttext" title="imagetooltip" />

    this then changed to
    <img src="/assets/soletrader/libraries/general/myimage.png" sfref="~/assets/soletrader/libraries/general/myimage.png" href="/imagelink" alt="imagealttext" title="imagetooltip" />

    the image then failed to show properly.
    I have fixed this by changing the src value to "https://www.soletrader.co.uk/assets..." and by deleting the sfref. [we are an ecommerce site and have some https sections, hence the src="https://..."]
    what is sfref, and why does sitefinity add it?
    Am I right that the value has changed from hexadecimal to "~/..."?
    Was it this change that caused the image to fail to show?

    How do I stop this reoccuring for other images in resources?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    25 Apr 2017
    18 Apr 2011
    Link to this post
    Hi Will,

    sfref is an attribute that we use to resolve dynamic links. Its value is [Provider]Guid - this shows the data provider and the item ID. When the content is saved or edited we call LinkParser.ResoveLinks and pass the entire HTML of the content item. We check for this attribute and its value. Then we set the proper href if the item is found.Generally you should not change the sfref, otherwise the item url will not be resolved properly and when you rename the content item( image, document etc) this will break the link.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

2 posts, 0 answered