english/libraries/joomla/html/html/image.php
/**
	 * Checks to see if an image exists in the current templates image directory.
	 * If it does it loads this image. Otherwise the default image is loaded.
	 * Also can be used in conjunction with the menulist param to create the chosen image
	 * load the default or use no image.
	 *
	 * @param   string   $file       The file name, eg foobar.png.
	 * @param   string   $folder     The path to the image.
	 * @param   integer  $altFile    Empty: use $file and $folder, -1: show no image, not-empty: use $altFile and $altFolder.
	 * @param   string   $altFolder  Another path.  Only used for the contact us form based on the value of the imagelist param.
	 * @param   string   $alt        Alternative text.
	 * @param   array    $attribs    An associative array of attributes to add.
	 * @param   boolean  $asTag      True (default) to display full tag, false to return just the path.
	 *
	 * @deprecated
	 * @since    11.1
	 */
Checks to see if an image exists in the current templates image directory.
If it does it loads this image. Otherwise the default image is loaded.
Also can be used in conjunction with the menulist param to create the chosen image
load the default or use no image.

@param   string   $file       The file name, eg foobar.png.
@param   string   $folder     The path to the image.


Checks to see if an image exists in the current templates image directory . If it does it loads this image . Otherwise the default image is loaded . Also can be used in conjunction with the menulist param to create the chosen image load the default or use no image . @param string $file The file name eg foobar . png . @param string $folder The path to the image .
public static function site($file, $folder = '/images/system/', $altFile = null, $altFolder = '/images/system/', $alt = null, $attribs = null, $asTag = true)
	{
		static $paths;
		$app = JFactory::getApplication();
		if (!$paths) {
			$paths = array();
		}
		if (is_array($attribs)) {
			$attribs = JArrayHelper::toString($attribs);
		}
		$cur_template = $app->getTemplate();
		$alt = html_entity_decode($alt, ENT_COMPAT, 'UTF-8');
		if ($altFile) {
			$src = $altFolder . $altFile;
		}
		else if ($altFile == -1) {
			return '';
		}
		else
		{
			$path = JPATH_SITE .'/templates/'. $cur_template .'/images/'. $file;
			if (!isset($paths[$path]))
			{
				if (file_exists(JPATH_SITE .'/templates/'. $cur_template .'/images/'. $file)) {
					$paths[$path] = 'templates/'. $cur_template .'/images/'. $file;
				}
				else
				{
					$paths[$path] = $folder . $file;
				}
			}
			$src = $paths[$path];
		}
		if (substr($src, 0, 1) == "/") {
			$src = substr_replace($src, '', 0, 1);
		}
		$src = JURI::base(true).'/'.$src;
		if ($asTag) {
			return '<img src="'.$src.'" alt="'.$alt.'" '.$attribs.' />';
		}
		return $src;
	}
public static function site ( $ file , $ folder = '/images/system/' , $ altFile = null , $ altFolder = '/images/system/' , $ alt = null , $ attribs = null , $ asTag = true ) { static $ paths ; $ app = JFactory :: getApplication ( ) ; if ( ! $ paths ) { $ paths = array ( ) ; } if ( is_array ( $ attribs ) ) { $ attribs = JArrayHelper :: toString ( $ attribs ) ; } $ cur_template = $ app -> getTemplate ( ) ; $ alt = html_entity_decode ( $ alt , ENT_COMPAT , 'UTF-8' ) ; if ( $ altFile ) { $ src = $ altFolder . $ altFile ; } else if ( $ altFile == - 1 ) { return '' ; } else { $ path = JPATH_SITE . '/templates/' . $ cur_template . '/images/' . $ file ; if ( ! isset ( $ paths [ $ path ] ) ) { if ( file_exists ( JPATH_SITE . '/templates/' . $ cur_template . '/images/' . $ file ) ) { $ paths [ $ path ] = 'templates/' . $ cur_template . '/images/' . $ file ; } else { $ paths [ $ path ] = $ folder . $ file ; } } $ src = $ paths [ $ path ] ; } if ( substr ( $ src , 0 , 1 ) == " / " ) { $ src = substr_replace ( $ src , '' , 0 , 1 ) ; } $ src = JURI :: base ( true ) . '/' . $ src ; if ( $ asTag ) { return '<img src="' . $ src . '" alt="' . $ alt . '" ' . $ attribs . ' />' ; } return $ src ; }
Checks to see if an image exists in the current templates image directory.
Checks to see if an image exists in the current templates image directory .
// Strip HTML. // Outputs only path to image. // Prepend the base path. // Outputs actual HTML <img> tag.