english/libraries/joomla/html/html/list.php
/**
	 * Build the select list to choose an image
	 */
Build the select list to choose an image
Build the select list to choose an image
public static function images($name, $active = NULL, $javascript = NULL, $directory = NULL, $extensions =  "bmp|gif|jpg|png")
	{
		if (!$directory) {
			$directory = '/images/';
		}
		if (!$javascript) {
			$javascript = "onchange=\"if (document.forms.adminForm." . $name . ".options[selectedIndex].value!='') {document.imagelib.src='..$directory' + document.forms.adminForm." . $name . ".options[selectedIndex].value} else {document.imagelib.src='templates/bluestork/images/admin/blank.png'}\"";
		}
		jimport('joomla.filesystem.folder');
		$imageFiles	= JFolder::files(JPATH_SITE . '/' . $directory);
		$images		= array(JHtml::_('select.option', '', JText::_('JOPTION_SELECT_IMAGE')));
		foreach ($imageFiles as $file) {
			if (preg_match('#('.$extensions.')$#', $file)) {
				$images[] = JHtml::_('select.option', $file);
			}
		}
		$images = JHtml::_(
			'select.genericlist',
			$images,
			$name,
			array(
				'list.attr' => 'class="inputbox" size="1" '. $javascript,
				'list.select' => $active
			)
		);
		return $images;
	}
public static function images ( $ name , $ active = NULL , $ javascript = NULL , $ directory = NULL , $ extensions = " bmp|gif|jpg|png " ) { if ( ! $ directory ) { $ directory = '/images/' ; } if ( ! $ javascript ) { $ javascript = " onchange= \" if (document.forms.adminForm. " . $ name . " .options[selectedIndex].value!='') {document.imagelib.src='.. $ directory ' + document.forms.adminForm. " . $ name . " .options[selectedIndex].value} else {document.imagelib.src='templates/bluestork/images/admin/blank.png'} \" " ; } jimport ( 'joomla.filesystem.folder' ) ; $ imageFiles = JFolder :: files ( JPATH_SITE . '/' . $ directory ) ; $ images = array ( JHtml :: _ ( 'select.option' , '' , JText :: _ ( 'JOPTION_SELECT_IMAGE' ) ) ) ; foreach ( $ imageFiles as $ file ) { if ( preg_match ( '#(' . $ extensions . ')$#' , $ file ) ) { $ images [ ] = JHtml :: _ ( 'select.option' , $ file ) ; } } $ images = JHtml :: _ ( 'select.genericlist' , $ images , $ name , array ( 'list.attr' => 'class="inputbox" size="1" ' . $ javascript , 'list.select' => $ active ) ) ; return $ images ; }
Build the select list to choose an image
Build the select list to choose an image