mirror of
https://github.com/e107inc/e107.git
synced 2025-02-24 16:52:43 +01:00
41 lines
1.6 KiB
Python
41 lines
1.6 KiB
Python
// $Id: imageselector.sc,v 1.2 2007-05-28 18:49:08 e107steved Exp $
|
|
|
|
global $sql,$parm;
|
|
|
|
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) = explode(",",$parm);
|
|
}
|
|
|
|
|
|
require_once(e_HANDLER."file_class.php");
|
|
$fl = new e_file;
|
|
|
|
// $paths = explode("|",$path);
|
|
$recurse = ($subdirs) ? $subdirs : 0;
|
|
if($imagelist = $fl->get_files($path,".jpg|.gif|.png|.JPG|.GIF|.PNG", 'standard', $recurse)){
|
|
sort($imagelist);
|
|
}
|
|
|
|
$multi = ($multiple == "TRUE" || $multiple == "1") ? "multiple='multiple' style='height:{$height}'" : "style='float:left'";
|
|
$width = ($width) ? $width : "*";
|
|
$height = ($height) ? $height : "*";
|
|
$label = ($label) ? $label : " -- -- ";
|
|
|
|
$text .= "<select {$multi} class='tbox' name='$name' id='$name' onchange=\"preview_image('$name','$path','".e_IMAGE_ABS."generic/blank.gif');\">
|
|
<option value=''>".$label."</option>\n";
|
|
foreach($imagelist as $icon)
|
|
{
|
|
$dir = str_replace($path,"",$icon['path']);
|
|
$selected = ($default == $dir.$icon['fname']) ? " selected='selected'" : "";
|
|
$text .= "<option value='".$dir.$icon['fname']."'".$selected.">".$dir.$icon['fname']."</option>\n";
|
|
}
|
|
$text .= "</select>";
|
|
|
|
$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
|
|
$text .= " <img id='{$name}_prev' src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' />\n";
|
|
|
|
|
|
return "\n\n<!-- Start Image Selector -->\n\n".$text."\n\n<!-- End Image Selector -->\n\n"; |