This value object wraps an HTML string for an image and allows you to get and set certain value object properties and then get the resulting <IMG> tag HTML markup string. If the ImageUrl property does not have a value, then the ToString method returns an empty string. In other cases, the ToString method returns a string of HTML that contains an <IMG> tag, possibly enclosed in an <A> tag hyperlink, depending on the values of its Hyperlink property. Only certain properties are recognized on the <A> and <IMG> tags and are used to generate the HTML string.
For the <A> tag:
For the <IMG> tag:
-
Src (required)
-
Align
-
Alt
-
Border
-
Height
-
Hspace
-
Vspace
-
width
For an ImageField column, instances are usually retrieved from an SPListItem field value. SPListItem is also used to store the posted value in a RichImageField and RichImageSelector control. Additionally, you can construct a new instance directly as an empty value or a value based on an HTML string that conforms to the basic pattern of an <IMG> tag optionally enclosed in an <A> tag. After you retrieve this value from an SPListItem field and change any properties on this object, you must set the value object back to the SPListItem field value and update it to store the value.