public static function getPluginImage($folder, $plugin, $image, $dir = 'img')
	{
		$image = ltrim($image, DS);

		if (!self::isImage($image))
		{
			return $image;
		}

		$template = 'system';
		if ($t = self::app('template'))
		{
			$template = self::app('template')->template;
		}

		$paths = array();
		$paths[] = DS . 'templates' . DS . $template . DS . 'html' . DS . 'plg_' . $folder . '_' . $plugin . DS . 'images' . DS . $image;
		$paths[] = DS . 'plugins' . DS . $folder . DS . $plugin . DS . 'assets' . ($dir ? DS . $dir : '') . DS . $image;
		$paths[] = DS . 'plugins' . DS . $folder . DS . $plugin . DS . 'images' . DS . $image;

		// Run through each path until we find one that works
		foreach ($paths as $i => $path)
		{
			$root = JPATH_SITE;
			if ($i == 0)
			{
				$root = JPATH_ADMINISTRATOR;
			}

			if (file_exists($root . $path))
			{
				if ($i == 0)
				{
					$b = rtrim(Request::base(true), DS);
				}
				else
				{
					$b = str_replace('/administrator', '', rtrim(Request::base(true), DS));
				}
				// Push script to the document
				return $b . $path;
			}
		}
	}
public static function getPluginImage($folder, $plugin, $image, $dir = 'img')
	{
		$image = ltrim($image, DS);

		if (!self::isImage($image))
		{
			return $image;
		}

		$template = 'system';
		if ($t = self::app('template'))
		{
			$template = self::app('template')->template;
		}

		$paths = array();
		$paths[] = DS . 'templates' . DS . $template . DS . 'html' . DS . 'plg_' . $folder . '_' . $plugin . DS . 'images' . DS . $image;
		$paths[] = DS . 'plugins' . DS . $folder . DS . $plugin . DS . 'assets' . ($dir ? DS . $dir : '') . DS . $image;
		$paths[] = DS . 'plugins' . DS . $folder . DS . $plugin . DS . 'images' . DS . $image;

		// Run through each path until we find one that works
		foreach ($paths as $i => $path)
		{
			$root = JPATH_SITE;
			if ($i == 0)
			{
				$root = JPATH_ADMINISTRATOR;
			}

			if (file_exists($root . $path))
			{
				if ($i == 0)
				{
					$b = rtrim(Request::base(true), DS);
				}
				else
				{
					$b = str_replace('/administrator', '', rtrim(Request::base(true), DS));
				}
				// Push script to the document
				return $b . $path;
			}
		}
	}
public static function getPluginImage ( $ folder , $ plugin , $ image , $ dir = 'img' ) { $ image = ltrim ( $ image , DS ) ; if ( ! self :: isImage ( $ image ) ) { return $ image ; } $ template = 'system' ; if ( $ t = self :: app ( 'template' ) ) { $ template = self :: app ( 'template' ) -> template ; } $ paths = array ( ) ; $ paths [ ] = DS . 'templates' . DS . $ template . DS . 'html' . DS . 'plg_' . $ folder . '_' . $ plugin . DS . 'images' . DS . $ image ; $ paths [ ] = DS . 'plugins' . DS . $ folder . DS . $ plugin . DS . 'assets' . ( $ dir ? DS . $ dir : '' ) . DS . $ image ; $ paths [ ] = DS . 'plugins' . DS . $ folder . DS . $ plugin . DS . 'images' . DS . $ image ; // Run through each path until we find one that works foreach ( $ paths as $ i => $ path ) { $ root = JPATH_SITE ; if ( $ i == 0 ) { $ root = JPATH_ADMINISTRATOR ; } if ( file_exists ( $ root . $ path ) ) { if ( $ i == 0 ) { $ b = rtrim ( Request :: base ( true ) , DS ) ; } else { $ b = str_replace ( '/administrator' , '' , rtrim ( Request :: base ( true ) , DS ) ) ; } // Push script to the document return $ b . $ path ; } } }
Gets the path to a plugin image
checks template overrides first, then plugin folder

@param   string  $folder  Plugin folder name
@param   string  $plugin  Plugin name
@param   string  $image   Image to look for
@param   string  $dir     Asset directory to look in
@return  string	Path to an image file
Gets the path to a plugin image checks template overrides first then plugin folder