// $Id: imageselector.sc,v 1.6 2008-03-18 00:39:02 e107coders Exp $
global $sql,$parm,$tp;
if(strstr($parm,"="))
{ // query style parms.
parse_str($parm, $tmp);
extract($tmp);
}
else
{ // comma separated parms.
list($name,$path,$default,$width,$height,$multiple,$label,$subdirs,$filter,$fullpath,$click_target,$click_prefix,$click_postfix) = explode(",",$parm);
}
require_once(e_HANDLER."file_class.php");
$fl = new e_file;
$paths = explode("|",$path);
$recurse = ($subdirs) ? $subdirs : 0;
$imagelist = array();
foreach($paths as $pths)
{
$imagelist += $fl->get_files($pths,".jpg|.gif|.png|.JPG|.GIF|.PNG", 'standard', $recurse);
}
if($imagelist)
{
sort($imagelist);
}
if(!$fullpath && (count($paths) > 1))
{
$fullpath = TRUE;
}
$multi = ($multiple == "TRUE" || $multiple == "1") ? "multiple='multiple' style='height:{$height}'" : "style='float:left'";
$width = ($width) ? $width : "*";
$height = ($height) ? $height : "*";
$label = ($label) ? $label : " -- -- ";
if(trim($default[0])=="{")
{
$pvw_default = $tp->replaceConstants($default);
$path = ""; // remove the default path if a constant is used.
}
$text .= "";
if(!$pvw_default)
{
$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
}
if(varset($click_target))
{
$pre = varset($click_prefix);
$post = varset($click_postfix);
$text .= "";
}
$text .= "
\n";
if(varset($click_target))
{
$text .= "";
}
//$text .= "
\n";
return "\n\n\n\n".$text."\n\n\n\n";