Access Sitecore media items
Version:
You can use the Sitecore.Data.Items.MediaItem class to access media items. For example, you can use this class to obtain an image in the Site Media Library to display in a component. Pass a Sitecore.Data.Items.Item representing the media item as the first parameter to the constructor for Sitecore.Data.Items.MediaItem. For example, to access the /Sitecore/Media Library/Files/Sample media item in the Master database: