Last active
August 29, 2015 14:14
-
-
Save adamhopkinson/2b2421c9eb5ff5ad5514 to your computer and use it in GitHub Desktop.
Using a Sitecore ImageField
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ImageField field = context.Fields["Img"]; | |
if (field != null && field.MediaItem != null) | |
{ | |
var ImgItem = new Sitecore.Data.Items.MediaItem(field.MediaItem); | |
var ImgUrl = Sitecore.Resources.Media.MediaManager.GetMediaUrl(ImgItem); | |
var ImgCaption = field.Alt; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment