Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: patTemplate

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /pattemplate/patTemplate/Modifier/HTML/Img.php

Documentation is available at Img.php

  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 109 2004-04-11 08:47:45Z schst $
  8.  *
  9.  * @package        patTemplate
  10.  * @subpackage    Modifiers
  11.  * @author        Stephan Schmidt <[email protected]>
  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 109 2004-04-11 08:47:45Z schst $
  23.  *
  24.  * @package        patTemplate
  25.  * @subpackage    Modifiers
  26.  * @author        Stephan Schmidt <[email protected]>
  27.  */
  28. {
  29.    /**
  30.     * modify the value
  31.     *
  32.     * @access    public
  33.     * @param    string        value
  34.     * @return    string        modified value
  35.     */
  36.     function modify$value$params array() )
  37.     {
  38.         $size getimagesize$value );
  39.         $params['src']    $value;
  40.         $params['width']  $size[0];
  41.         $params['height'$size[1];
  42.         return '<img'.$this->arrayToAttributes($params).' />';
  43.     }
  44.  
  45.    /**
  46.     * create an attribute list
  47.     *
  48.     * @access    private
  49.     * @param    array 
  50.     * @return    string 
  51.     */
  52.     function arrayToAttributes$array )
  53.     {
  54.         $string '';
  55.         foreach$array as $key => $val )
  56.         {
  57.             $string .= ' '.$key.'="'.htmlspecialchars$val ).'"';
  58.         }
  59.         return $string;
  60.     }
  61. }
  62. ?>

Documentation generated on Mon, 05 Mar 2007 21:07:39 +0000 by phpDocumentor 1.3.1