Image Element

An image element is an optional subelement of a channel, representing a graphic. It contains three mandatory elements:

url - is the URL of a GIF, JPEG or PNG image that represents the channel. This value is retrieved with the getUrl method.


$url = $imageElement->getUrl();

title - describes the image. It is used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML. This value is retrieved with the getTitle method.


$title = $imageElement->getTitle();

link - the URL of the site, when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>. This value is retrieved with the getLink method.


$link = $imageElement->getLink();

and optional elements:

width - the width of the image in pixels (maximum 144, default 88). This value is retrieved with the getWidth method.


$width = $imageElement->getWidth();

height - the height of the image in pixels (maximum 400, default 31). This value is retrieved with the getHeight method.


$height = $imageElement->getHeight();

description - contains text that is included in the TITLE attribute of the link formed around the image in the HTML rendering. This value is retrieved with the getDescription method.


$description = $imageElement->getDescription();

An example of rendering an image to the browser window is:


case DOMIT_RSS_ELEMENT_IMAGE:
	echo '<p><image src="' . $element->getUrl() . 
			'" width="' . $element->getWidth() .
			'" height="' . $element->getHeight() . 
			'" alt="' . $element->getTitle() .  
			"\" /></p>\n";
	break;

The resulting html code would look something like:


<p><img src='http://www.engageinteractive.com/domit/domitBanner.gif' 
		width='144' height='75' alt='DOMIT Banner' /></p>


Documentation generated by ClassyDoc, using the DOMIT! and SAXY parsers.
Please visit Engage Interactive to download free copies.