Image to URL properties

Vote:
 
I have an image to url property in my template, but I dont want to add a string property for teh alt text, I want to use the description which is a property in the image. Is this possible? Obviously he image to url property just gives me its URL and not the actual image object, If there isnt a standard way I think I will have to create an image property?
#19847
May 08, 2008 12:27
Vote:
 
Does anyone know if this is possible, I would also like to use the description as the ALT tag for the image.
#31355
Jul 22, 2009 15:54
Vote:
 

Hi Chris and Tony.

This is possible, but you have to get the picture file object to find the meta tags associated to it. You could do it like this:

UnifiedFile file = HostingEnvironment.VirtualPathProvider.GetFile("PathToFile") as UnifiedFile;
if (file != null && file.Summary.Dictionary.Contains("Description"))
{
string altText = file.Summary.Dictionary["Description"].ToString();
}
Hope this helps!
Br, Tore 

 

#31363
Jul 23, 2009 8:27
Vote:
 

This solved the same problem for me, thanks Tore.

#38428
Apr 09, 2010 12:56