| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?PHP 2 /** 3 * Modifier that creates an HTML image tag from a variable 4 * 5 * It automatically retrieves the width and height of the image. 6 * 7 * $Id: Img.php 10381 2008-06-01 03:35:53Z pasamio $ 8 * 9 * @package patTemplate 10 * @subpackage Modifiers 11 * @author Stephan Schmidt <schst@php.net> 12 */ 13 14 // Check to ensure this file is within the rest of the framework 15 defined('JPATH_BASE') or die(); 16 17 /** 18 * Modifier that creates an HTML image tag from a variable 19 * 20 * It automatically retrieves the width and height of the image. 21 * 22 * $Id: Img.php 10381 2008-06-01 03:35:53Z pasamio $ 23 * 24 * @package patTemplate 25 * @subpackage Modifiers 26 * @author Stephan Schmidt <schst@php.net> 27 */ 28 class patTemplate_Modifier_HTML_Img extends patTemplate_Modifier 29 { 30 /** 31 * modify the value 32 * 33 * @access public 34 * @param string value 35 * @return string modified value 36 */ 37 function modify( $value, $params = array() ) 38 { 39 $size = getimagesize( $value ); 40 $params['src'] = $value; 41 $params['width'] = $size[0]; 42 $params['height'] = $size[1]; 43 return '<img'.$this->arrayToAttributes($params).' />'; 44 } 45 46 /** 47 * create an attribute list 48 * 49 * @access private 50 * @param array 51 * @return string 52 */ 53 function arrayToAttributes( $array ) 54 { 55 $string = ''; 56 foreach( $array as $key => $val ) 57 { 58 $string .= ' '.$key.'="'.htmlspecialchars( $val ).'"'; 59 } 60 return $string; 61 } 62 } 63 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |