1 <?php /* vim: set binary expandtab tabstop=4 shiftwidth=4 textwidth=80:
2 -------------------------------------------------------------------------------
4 -------------------------------------------------------------------------------
5 This file is part of mlib.
7 mlib is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2 of the License, or (at your option)
12 mlib is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License; if not,
17 write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------
20 Creado: Thu Aug 21 15:09:10 2003
21 Author: Leandro Lucarella <llucar@mecon.gov.ar>
22 -------------------------------------------------------------------------------
24 -----------------------------------------------------------------------------*/
27 require_once 'HTML/Common.php';
30 // +X2C Class 537 :MLIB_HTML_Image
32 * HTML Image representation.
37 class MLIB_HTML_Image extends HTML_Common {
44 * @param string $src Image location.
45 * @param string $alt Alternate text.
46 * @param array $attrs Other image attributes.
51 function MLIB_HTML_Image($src = '', $alt = '', $attrs = array()) // ~X2C
53 if (is_array($attrs)) {
57 $attrs .= " src=$src alt=$alt";
59 parent::HTML_Common($attrs);
65 * Converts to HTML output.
70 function toHtml() // ~X2C
73 $attributes = $this->getAttributes() + array('border' => 0);
74 foreach ($attributes as $key => $val) {
75 $attrs .= ' ' . $key . '="' . htmlentities($val) . '"';
77 return "<img$attrs/>";
83 * Gets image location.
88 function getSrc() // ~X2C
90 return $this->getAttribute('src');
96 * Sets image location.
98 * @param string $src Image location.
103 function setSrc($src) // ~X2C
105 $this->updateAttributes(array('src' => $src));
109 // +X2C Operation 173
111 * Gets image alternate text.
116 function getAlt() // ~X2C
118 return $this->getAttribute('alt');
122 // +X2C Operation 174
124 * Sets image alternate text.
126 * @param string $alt Alternate text.
131 function setAlt($alt) // ~X2C
133 $this->updateAttributes(array('alt' => $alt));
137 } // -X2C Class :MLIB_HTML_Image