Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Url property type with UIHint "Image" problem

Vote:
 

We have upgraded our site to EPiServer CMS 7.5. One of our blocks is using a Url property with UIHint of "Image" that gets an image from the new Asset Management system. I noticed that the value of the Url property becomes like "/link/2ec8f6c283a14b689f4c79111f315d1b.aspx?id=213&epslanguage=en" and then it seemed to redirect to /globalassets/image.jpg

Is this the new behavior of Url property in EPiServer CMS 7.5? We are using ImageResizer plugin and embedding the query string to resize the image becomes a problem.

#79276
Dec 12, 2013 11:31
Vote:
 

ImageResizer doesn't work with EPiServer 7.5 out of the box, read my blog post for a basic understanding of what to do when using ImageResizer (http://world.episerver.com/Blogs/Andre-Hedberg/Dates/2013/12/Get-ImageResizer-to-play-along-with-EPiServer-75/).

I think the link becomes in that format since you use "Url" as the property type and not "ContentReference". Correct me if I'm wrong. :)

#79279
Dec 12, 2013 12:26
Vote:
 

I have managed to make ImageResizer work with our new site :) The behavior of Url property is what concerns me. I think i will try using ContentReference.

#79281
Dec 12, 2013 13:03
Vote:
 

Url should still be valid to use with the new Assets system. ContentReference is somewhat preferred from a performance perspective if you do not require additional query string parameters which I assume is the case if you want to use ImageResizer. Url will convert the "public" url to an internal format to handle changes in the URL structure (aka permanent links). When shown on the site, it should convert to the public format together with any custom query string parameters you have added to the URL.

What exactly is your problem? Are the links not converted to the public format on the site or are you loosing query string parameters?

#79282
Dec 12, 2013 13:10
Vote:
 

When I add a query string to the Url property, for example using ImageResizer:

<img src='<%= CurrentBlock["ImageUrl"] %>?width=270' />

the image markup becomes:

<img src='/link/2ec8f6c283a14b689f4c79111f315d1b.aspx?id=213&epslanguage=en?width=270' />

which I get an YSOD. It was working before we upgrade the site to 7.5

#79284
Dec 12, 2013 13:23
Vote:
 

You could try to convert your permanentlink to a FURL before writing it to output. Something like:

<img src='<%= EPiServer.Web.UrlResolver.Current.GetUrl(CurrentBlock["ImageUrl"]) %>?width=270' />

#79289
Dec 12, 2013 14:16
Vote:
 

I actually have no idea why it was working before the release. Adding a query string parameter with a hard coded "?" to a link where you do not have control of the format is always a risc since you do not know if the original link already contains a query string or not. I would either add a better handler to add your additional query string (that is, use a class to modify the URL or at least check if the URL already contains a '?'-character) or use the UrlResolver as Johan suggested.

#79290
Dec 12, 2013 14:32
Vote:
 

Thank you. My problem is now resolved.

#79309
Dec 13, 2013 7:52
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.