Created
October 30, 2014 05:12
-
-
Save RyanABailey/84447ae0bdf9c0238d75 to your computer and use it in GitHub Desktop.
sitecore get image url
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
| /// <summary> | |
| /// get image url from sitecore imagefield | |
| /// </summary> | |
| /// <param name="field">imagefield</param> | |
| /// <returns>image url</returns> | |
| public static string GetImageURL(ImageField field) | |
| { | |
| string imageURL = string.Empty; | |
| if (field != null && field.MediaItem != null) | |
| { | |
| Sitecore.Data.Items.MediaItem image = new Sitecore.Data.Items.MediaItem(field.MediaItem); | |
| imageURL = Sitecore.Resources.Media.MediaManager.GetMediaUrl(image); | |
| } | |
| return imageURL; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment