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

Try our conversational search powered by Generative AI!

How to achieve description of image stored in the file manager of Episerver



I have a problem achieving the meta data from files stored in the file manager in Episerver.

There is a function in our solution that is supposed to fix this, but often it doesn't work.

I use the function below to get description information from the files, but very often it returns nothing.

Anyone have a better/safer method to get the description information stored on files in Episerver - File manager?



String imagedescription = GetMetaDataFromImageURL(CurrentPage["MainIntroPicture"].ToString(), "Description");



protected static string GetMetaDataFromImageURL(string imageurl, string metainstance)

string s = string.Empty;
if (imageurl!=null)
UnifiedFile uf = HostingEnvironment.VirtualPathProvider.GetFile(imageurl) as UnifiedFile;
if (uf != null)
if (uf.Summary.Dictionary[metainstance] != null)
s = uf.Summary.Dictionary[metainstance].ToString();
return s;

Feb 13, 2013 17:08

Just tried your code, it works.

I'm guessing your MainIntroPicture property is of type "URL to image"? (which will render a relative path to the file, like "/Global/Images/mypicture.jpg")

However, you shouldn't do CurrentPage["MainIntroPicture"].ToString(), since it will throw a NULL reference exception if the property has no value set. Do GetMetaDataFromImageURL(CurrentPage["MainIntroPicture"] as string, "Description") instead, or CurrentPage.MainIntroPicture if you're using PTB.


Feb 13, 2013 22:09

Good tip Arild, I will change that.

I found the error. They say you can't see the forrest because of all the trees.

Kind of the same here. You can't see the function-error because of all the code.

I was missing Server.UrlDecode on CurrentPage["MainIntroPicture"].

Correct code is:

String imagedescription = GetMetaDataFromImageURL(Server.UrlDecode(CurrentPage["MainIntroPicture"] as String), "Description");


Feb 15, 2013 10:21
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.