Try our conversational search powered by Generative AI!

Get Full File Path of ImageFile


Hi all,

I am trying to get the URL of an image file with it's file extension.

When I retrieve the URL back using UrlResolver.Current.GetUrl(contentReference.ContentLink) I get the URL to the place where it is sitting in the ContentFolder.

We use the same image over our site with varying sizes of that image. Rather than make the user upload an image for every size we are using an image resizing tool, that takes the url and resizes the picture for the user in each area it is displayed

Our HTML looks like this:


Where @Image is the result of the GetUrl call above.

This works fine with full URLs, but does not work with the ones the GetUrl returns.

Any ideas on what I can do?

Jul 25, 2014 2:47

You can get the FilePath for a FileBlob (note that this only works for FileBlobProvider, which is the one used by default. It will not work e.g. for AzureBlobProvider) like

var filePath = (ServiceLocator.Current.GetInstance().Get(contentLink).BinaryData as FileBlob).FilePath;

Otherwise you could use additional Blob properties to get scaled sizes of the image, see e.g.

Jul 25, 2014 8:33

Hi Johan,

I found another blog post linked in the link you gave me for getting image resizer to play nicely with EPiServer. Which solved all my problems.

Thanks for your help!

Jul 28, 2014 0:46
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.