AI OnAI Off
You can change how the url should be rendered by changing the context mode:
UrlResolver.Current.GetUrl(SomeContentReference, null, new VirtualPathArguments() { ContextMode = ContextMode.Default });
By using the "default" mode, the link will be rendered as if you were in view mode, even if you are in edit mode
Here is some code that you can use that will make sure that the context not being forced to default/view. The reason that you want to keep the context when displaying images is that images requested through the editorial URL is not cached, so when an editor uploads a new image this will bypass the browser/server caches and thus give less confusion for the editors:
var routeValues = new RouteValueDictionary();
routeValues["action"] = "Thumbnail";
var url = UrlResolver.Current.GetUrl(CurrentPage.SomeImageReference, null, new VirtualPathArguments() { RouteValues = routeValues });
Thank you Linus. The images are not displayed as properties in the editorial view though. Would the cachning still affect the output of the image listing?
Hi
I've started to look into the Blob property type in 7.5. I have a class ImageFile extending ImageData where i have created a new Blob property ListThumbnail with set width and height. I also have a Block Type where I want to print all images listed on the blocks own content folder using my ListThumbnail representation of the image. However I can not find a nice way to get the correct url. I have tried to get the url for the ImageFile and then just append /ListThumbnail to that in the template. This works in preview mode but in edit mode this results in an url wich looks like 'http://localhost:3603/epiui/CMS/Content/contentassets/en-US/1aba9e3b9f584226b43e52648555e065/banner-2.jpg,,305?epieditmode=False/ListThumbnail' wich obviously does not give me the image size I want.
Is there any other way to route the Blob's url or is my only option to use some ugly string handling to remove the query from the url in edit mode?
Thanks