15 |
function smarty_func_img() { |
function smarty_func_img() { |
16 |
extract(func_get_arg(0)); |
extract(func_get_arg(0)); |
17 |
|
|
18 |
$f=Array(); |
$f = array(); |
19 |
|
|
20 |
global $img_time; |
global $img_time; |
21 |
if (!isset($img_time)) { |
if (!isset($img_time)) { |
22 |
$img_time=time(); |
$img_time=time(); |
23 |
} |
} |
24 |
|
|
|
|
|
25 |
if (isset($dir)) { |
if (isset($dir)) { |
26 |
$tdir=dir2path($dir); |
$tdir=dir2path($dir); |
27 |
$h=opendir($dir); |
$h=opendir($dir); |
124 |
$ext=strtoupper(array_pop($ext)); |
$ext=strtoupper(array_pop($ext)); |
125 |
|
|
126 |
if ($size=filesize($path)) { |
if ($size=filesize($path)) { |
127 |
switch ($unit) { |
switch (strtoupper($unit)) { |
128 |
case 'Mb': |
case 'MB': |
129 |
case 'mb': |
return sprintf("%s, %2.1f MB",$ext,$size/(1024*1024)); |
130 |
return sprintf("%s, %2.1f Mb",$ext,$size/(1024*1024)); |
case 'KB': |
131 |
case 'Kb': |
return sprintf("%s, %2.1f kB",$ext,$size/1024); |
|
case 'kb': |
|
|
return sprintf("%s, %2.1f Mb",$ext,$size/1024); |
|
132 |
case 'auto': |
case 'auto': |
133 |
$size=$size/1024; # Kb |
$size=$size/1024; # Kb |
134 |
if ($size > 1024) { |
if ($size > 1024) { |
135 |
return sprintf("%s, %2.1f Mb",$ext,$size/1024); |
return sprintf("%s, %2.1f MB",$ext,$size/1024); |
136 |
} else { |
} else { |
137 |
return sprintf("%s, %2.1f Kb",$ext,$size); |
return sprintf("%s, %2.1f kB",$ext,$size); |
138 |
} |
} |
139 |
|
|
140 |
} |
} |
142 |
} |
} |
143 |
} |
} |
144 |
|
|
145 |
|
// pic_url|js_popup:"dir_reference" |
146 |
|
|
147 |
|
function smarty_mod_js_popup($pic, $dir) { |
148 |
|
if ($dir) { global ${$dir}; $pic = ${$dir}."/".$pic; } |
149 |
|
if ($pic) { |
150 |
|
@$size = GetImageSize($pic); |
151 |
|
list($w, $h) = array($size[0], $size[1]); |
152 |
|
} |
153 |
|
$opts = array("scrollbar=no", "menu=no", "personal=no"); |
154 |
|
// KLUDGY!!! I have to somehow include the window chrome (ie. |
155 |
|
// decorations: titlebar, borders...) when calculating |
156 |
|
// width/height... |
157 |
|
if ($w) $w += 18; |
158 |
|
if ($h) $h += 25; |
159 |
|
if ($w) array_push($opts, "width=$w"); |
160 |
|
if ($h) array_push($opts, "height=$h"); |
161 |
|
if (!$w) $w = 0; |
162 |
|
if (!$h) $h = 0; |
163 |
|
return "var tmp = window.open(this.href, this.target, '".implode(',', $opts)."'); if (tmp && tmp.moveTo) tmp.moveTo((screen.availWidth - $w) / 2, (screen.availHeight - $h) / 2); return false;"; |
164 |
|
} |
165 |
|
|
166 |
// input functions (input, rinput) |
// input functions (input, rinput) |
167 |
|
|
168 |
function smarty_func_input() { |
function smarty_func_input() { |