| 41 |
'ql' => 70, |
'ql' => 70, |
| 42 |
'wm' => '' |
'wm' => '' |
| 43 |
); |
); |
|
|
|
| 44 |
$global_var['image_sz']['640'] = array ( |
$global_var['image_sz']['640'] = array ( |
| 45 |
'x' => 640, |
'x' => 640, |
| 46 |
'y' => 480, |
'y' => 480, |
| 60 |
'wm' => '' |
'wm' => '' |
| 61 |
); |
); |
| 62 |
|
|
| 63 |
|
$global_var['image_sz']['default'] =& $global_var['image_sz']['640']; |
| 64 |
|
|
| 65 |
if(isset($_SERVER['PHP_SELF'])) { |
if(isset($_SERVER['PHP_SELF'])) { |
| 66 |
$php_self = $_SERVER['PHP_SELF']; |
$php_self = $_SERVER['PHP_SELF']; |
| 116 |
if(!file_exists($pwd.'/'.$global_var['path']['thumb_dir'])) |
if(!file_exists($pwd.'/'.$global_var['path']['thumb_dir'])) |
| 117 |
mkdir($pwd.'/'.$global_var['path']['thumb_dir'],0777); |
mkdir($pwd.'/'.$global_var['path']['thumb_dir'],0777); |
| 118 |
|
|
| 119 |
|
echo <<<EOT |
| 120 |
|
<div id="thumbnails_container">\n |
| 121 |
|
|
| 122 |
|
EOT; |
| 123 |
|
|
| 124 |
foreach($image_files as $image) { |
foreach($image_files as $image) { |
| 125 |
|
|
| 126 |
|
$thumb_image = $pwd.'/'.$global_var['path']['thumb_dir'].'/'.$image; |
| 127 |
|
|
| 128 |
// check if a thumbnail for current image exists, if not create one. |
// check if a thumbnail for current image exists, if not create one. |
| 129 |
if(!file_exists($pwd.'/'.$global_var['path']['thumb_dir'].'/'.$image)) |
if(!file_exists($thumb_image)) |
| 130 |
create_thumbnail($image); |
create_thumbnail($image); |
| 131 |
|
|
| 132 |
|
$thumb_sz = GetImageSize($thumb_image); |
| 133 |
|
|
| 134 |
echo <<<EOT |
echo <<<EOT |
| 135 |
<div class="thumbnail">\n |
<div class="thumbnail" style="width: {$thumb_sz[0]}px; height: {$thumb_sz[1]}px;">\n |
| 136 |
<a href="$php_self?dir=$pwd&img=$image"> |
<a href="$php_self?dir=$pwd&img=$image"> |
| 137 |
<img src="$pwd/{$global_var[path][thumb_dir]}/$image" alt=""/> |
<img src="$thumb_image" alt=""/> |
| 138 |
</a> |
</a> |
| 139 |
</div>\n |
</div>\n |
| 140 |
EOT; |
EOT; |
| 141 |
} |
} |
| 142 |
|
|
| 143 |
|
echo <<<EOT |
| 144 |
|
</div>\n |
| 145 |
|
<div style="clear: both;"><br/></div>\n |
| 146 |
|
EOT; |
| 147 |
} |
} |
| 148 |
|
|
| 149 |
|
|
| 153 |
{ |
{ |
| 154 |
global $global_var, $get_vars, $pwd; |
global $global_var, $get_vars, $pwd; |
| 155 |
|
|
| 156 |
if(file_exists($pwd.'/'.$get_vars['img'])) { |
$image = $pwd.'/'.$get_vars['img']; |
| 157 |
|
|
| 158 |
|
$cached_image = $pwd.'/'.$global_var['path']['cache_dir']; |
| 159 |
|
|
| 160 |
|
if(file_exists($image)) { |
| 161 |
|
|
| 162 |
|
$image_size = GetImageSize($image); |
| 163 |
|
|
| 164 |
|
if(isset($get_var['width'])) { |
| 165 |
|
if($get_var['width'] >= $image_size[0]) |
| 166 |
|
$cache_image = $image; |
| 167 |
|
} else { |
| 168 |
|
if(!file_exists($cached_image.'/default_'.$get_vars['img'])) { |
| 169 |
|
resize_image('default_'); |
| 170 |
|
} |
| 171 |
|
$cached_image = $cached_image.'/default_'.$get_vars['img']; |
| 172 |
|
} |
| 173 |
|
|
| 174 |
|
$image_size = GetImageSize($cached_image); |
| 175 |
|
|
| 176 |
echo <<<EOT |
echo <<<EOT |
| 177 |
<div id="image">\n |
<div id="image" style="width: {$image_size[0]}px; height: {$image_size[1]}px;">\n |
| 178 |
<img src="$pwd/{$get_vars[img]}" alt=""> |
<a href="$image" target="_blank"><img src="$cached_image" alt=""></a> |
| 179 |
</div>\n |
</div>\n |
| 180 |
EOT; |
EOT; |
| 181 |
} |
} |
| 184 |
|
|
| 185 |
|
|
| 186 |
|
|
| 187 |
function resize_image() |
function resize_image($prefix) |
| 188 |
{ |
{ |
| 189 |
|
global $global_var, $get_vars, $pwd; |
| 190 |
|
$src_image = $get_vars['img']; |
| 191 |
|
if(isset($global_var['external']['magick'])) { |
| 192 |
|
if(file_exists($pwd.'/'.$src_image)) { |
| 193 |
|
$src_image_sz = GetImageSize($pwd.'/'.$src_image); |
| 194 |
|
$resize_aspect = round(($global_var['image_sz']['default']['y'] / $src_image_sz[1])*100, 2); |
| 195 |
|
|
| 196 |
|
// DEBUG: print "Quality: ".$global_var['image_sz']['default']['ql'] ." Resize Aspect: ". $resize_aspect ."%"; |
| 197 |
|
|
| 198 |
|
exec($global_var['external']['magick'] |
| 199 |
|
.' -geometry '.$resize_aspect.'%' |
| 200 |
|
.' -quality '.$global_var['image_sz']['default']['ql'] |
| 201 |
|
.' '.$pwd.'/'.$src_image |
| 202 |
|
.' '.$pwd.'/'.$global_var['path']['cache_dir'].'/'.$prefix.$src_image |
| 203 |
|
); |
| 204 |
|
} |
| 205 |
|
} |
| 206 |
} |
} |
| 207 |
|
|
| 208 |
|
|
| 232 |
|
|
| 233 |
|
|
| 234 |
|
|
| 235 |
|
|
| 236 |
/** |
/** |
| 237 |
* Retrieves all directory names present in $path. Using |
* Retrieves all directory names present in $path. Using |
| 238 |
* eregi we exclude names we don't want in the list. |
* eregi we exclude names we don't want in the list. |
| 256 |
|
|
| 257 |
|
|
| 258 |
|
|
| 259 |
|
|
| 260 |
if (isset($get_vars['dir']) && is_dir(rawurldecode($get_vars['dir']))) |
if (isset($get_vars['dir']) && is_dir(rawurldecode($get_vars['dir']))) |
| 261 |
{ |
{ |
| 262 |
$pwd = rawurldecode($get_vars['dir']); |
$pwd = rawurldecode($get_vars['dir']); |
| 319 |
<meta name="description" content="{$global_var[metadata][description]}" /> |
<meta name="description" content="{$global_var[metadata][description]}" /> |
| 320 |
<meta name="robots" content="all" /> |
<meta name="robots" content="all" /> |
| 321 |
|
|
| 322 |
<title></title> |
<title>expose: </title> |
| 323 |
|
|
| 324 |
<style type="text/css"> |
<style type="text/css"> |
| 325 |
@import "/~ikea/style.css"; |
@import "/~ikea/style.css"; |
| 347 |
global $global_var; |
global $global_var; |
| 348 |
echo <<<EOF |
echo <<<EOF |
| 349 |
<div id="copyright">\n |
<div id="copyright">\n |
| 350 |
{$global_var[str_msg][copyright]} |
{$global_var[str_msg][copyright]}<br /> |
| 351 |
|
<a href="">expose</a> <span style="font-style: italic;">Cvs version: \$Revision$</span> |
| 352 |
</div> |
</div> |
| 353 |
</div> |
</div> |
| 354 |
</body> |
</body> |