It is a common scenario in WCM web sites, to have content page images stored in a column of type Image. SharePoint stores this kind of fields in the content database by storing the image HTML markup, storing an <IMG> tag like in the following example:
<IMG src=”/PublishingImages/picture.GIF” />
When working in context of a page layout, we can easily include image fields by inserting an Image Field control using SharePoint Designer. However, there are situations where we must use the SharePoint Publishing API and there’s where the ImageFieldValue class comes in hand. This class represents an <IMG> tag and its properties. A common situation is when you want to get the Image URL from its HTML markup. This example shows how it can easily be achieved by using the ImageFieldValue class:
public
static
string getImageUrl(string imageFieldHTMLMarkup)
{
Microsoft.SharePoint.Publishing.Fields.ImageFieldValue image =
new Microsoft.SharePoint.Publishing.Fields.ImageFieldValue(imageFieldHTMLMarkup);
return image.ImageUrl;
}
More information about the ImageFieldValue class can be found in the MSDN web site.
UPDATE 01/11/2018:
If you or your customers are not ready to move entirely to the Cloud and Office 365, a hybrid scenario could be an interesting scenario and SharePoint 2019 RTM was recently announced with improved hybrid support! To learn all about SharePoint 2019 and all its features, click here.
UPDATE 21/11/2018:
If you want to know all about the latest SharePoint and Office 365 announcements from Ignite and some more recent announcements, including Microsoft Search, What’s New to Build a Modern Intranet with SharePoint in Office 365, Deeper Integration between Microsoft Teams and SharePoint and the latest news on SharePoint development, click here.