Get image src and alt attribute in Sitecore 6?
sitecore
Solution
You will want to look at leveraging the Sitecore.Resources.Media.MediaManager to get the URL to a media library item.
Before you get there, get the field from the item and cast it to a FileField. Once you have a FileField you can get access to the MediaItem.
Item item = Sitecore.Context.Item;
Sitecore.Data.Fields.ImageField imgField = ((Sitecore.Data.Fields.ImageField)item.Fields["MyImage"]);
string url = Sitecore.Resources.Media.MediaManager.GetMediaUrl(imgField.MediaItem);
string altText = imgField.Alt;
Link to Sitecore Media Item
Problem
I use the following to get, for instance, the header of the current page; ``` Header = Sitecore.Context.Item["Header"] ``` But how would i go about getting the src url of a image field? ``` PictureSrc = Sitecore.Context.Item["MyImage"] ```