2 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
3 // +----------------------------------------------------------------------+
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2003 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Created: Mon Jun 30 19:46:34 2003 |
17 // | Authors: Leandro Lucarella <llucar@mecon.gov.ar> |
18 // | Martín Marrese <mmarre@mecon.gov.ar> |
19 // +----------------------------------------------------------------------+
25 require_once 'HTML/Common.php';
28 // +X2C Class 214 :Image
30 * HTML Image representation.
34 class HTML_Image extends HTML_Common {
42 * @param string $src Image location.
43 * @param string $alt Alternate text.
44 * @param array $attrs Other image attributes.
49 function HTML_Image($src = '', $alt = '', $attrs = array())// ~X2C
51 if (is_array($attrs)) {
55 $attrs .= " src=$src alt=$alt";
57 parent::HTML_Common($attrs);
63 * Converts to HTML output.
68 function toHtml()// ~X2C
71 $attributes = $this->getAttributes() + array('border' => 0, 'align' => 'middle');
72 foreach ($attributes as $key => $val) {
73 $attrs .= ' ' . $key . '="' . htmlentities($val) . '"';
75 return "<IMG$attrs/>";
81 * Gets image location.
86 function getSrc()// ~X2C
88 return $this->getAttribute('src');
94 * Sets image location.
96 * @param string $src Image location.
101 function setSrc($src)// ~X2C
103 $this->updateAttributes(array('src' => $src));
107 // +X2C Operation 219
109 * Gets image alternate text.
114 function getAlt()// ~X2C
116 return $this->getAttribute('alt');
120 // +X2C Operation 220
122 * Sets image alternate text.
124 * @param string $alt Alternate text.
129 function setAlt($alt)// ~X2C
131 $this->updateAttributes(array('alt' => $alt));
135 } // -X2C Class :Image