- md5
- 830e32485df3775641788453b2a022a6
- sha1
- 3616670d4aa4d78c37bba11d6d7517ca6958203b
- sha256
- b876697faed0d1ab3e9e8ec841f28b3330604b29b3d57db0183991e7c278ef00
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
<?PHP
/**
* Modifier that creates an HTML image tag from a variable
*
* It automatically retrieves the width and height of the image.
*
* $Id: Img.php 8287 2007-08-01 08:38:59Z eddieajau $
*
* @package patTemplate
* @subpackage Modifiers
* @author Stephan Schmidt <[email protected]>
*/
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();
/**
* Modifier that creates an HTML image tag from a variable
*
* It automatically retrieves the width and height of the image.
*
* $Id: Img.php 8287 2007-08-01 08:38:59Z eddieajau $
*
* @package patTemplate
* @subpackage Modifiers
* @author Stephan Schmidt <[email protected]>
*/
class patTemplate_Modifier_HTML_Img extends patTemplate_Modifier
{
/**
* modify the value
*
* @access public
* @param string value
* @return string modified value
*/
function modify( $value, $params = array() )
{
$size = getimagesize( $value );
$params['src'] = $value;
$params['width'] = $size[0];
$params['height'] = $size[1];
return '<img'.$this->arrayToAttributes($params).' />';
}
/**
* create an attribute list
*
* @access private
* @param array
* @return string
*/
function arrayToAttributes( $array )
{
$string = '';
foreach( $array as $key => $val )
{
$string .= ' '.$key.'="'.htmlspecialchars( $val ).'"';
}
return $string;
}
}
?>
The same content is in 4 releases, Joomla 1.5.0 to 1.5.3. See them all, or every version of this file.