71 |
'wm' => '' |
'wm' => '' |
72 |
); |
); |
73 |
|
|
74 |
|
$global_var['image_sz']['valid_sizes'] = array ( |
75 |
|
'640x480', |
76 |
|
'800x600', |
77 |
|
'1024x768' |
78 |
|
); |
79 |
|
|
80 |
$global_var['image_sz']['default'] =& $global_var['image_sz']['640']; |
$global_var['image_sz']['default'] =& $global_var['image_sz']['640']; |
81 |
|
|
|
$global_var['exif'] = array ( |
|
|
'Make', |
|
|
'ApertureFNumber', |
|
|
'FocalLength', |
|
|
'DateTime', |
|
|
'FlashMode' |
|
|
); |
|
82 |
$exif_headers = array (); |
$exif_headers = array (); |
83 |
|
|
84 |
|
|
97 |
|
|
98 |
|
|
99 |
/** |
/** |
|
* ! NOT IMPLEMENTED ! |
|
|
* |
|
100 |
* Extracts the EXIF header of a JPG if available using |
* Extracts the EXIF header of a JPG if available using |
101 |
* built-in php function exif_read_data, this information |
* built-in php function exif_read_data, this information |
102 |
* is extracted upon request and not written to disk. |
* is extracted upon request and not written to disk. |
112 |
|
|
113 |
foreach($exif_data as $exif_section_key => $exif_section) { |
foreach($exif_data as $exif_section_key => $exif_section) { |
114 |
foreach($exif_section as $exif_key => $exif_value) { |
foreach($exif_section as $exif_key => $exif_value) { |
|
|
|
|
if(array_search($exif_key, $global_var['exif'])) { |
|
115 |
|
|
116 |
switch($exif_key) { |
switch($exif_key) { |
117 |
case 'Make': |
case 'Model': |
118 |
array_push($exif_headers, 'Model: '.$exif_value); |
array_push($exif_headers, 'Model: '.$exif_value); |
119 |
break; |
break; |
120 |
|
|
136 |
case 'FlashMode': |
case 'FlashMode': |
137 |
switch($exif_value) { |
switch($exif_value) { |
138 |
case '0': |
case '0': |
139 |
array_push($exif_headers, 'Flash: Off'); |
array_push($exif_headers, 'Flash: Auto'); |
140 |
break; |
break; |
141 |
case '1': |
case '1': |
142 |
array_push($exif_headers, 'Flash: On'); |
array_push($exif_headers, 'Flash: On'); |
143 |
break; |
break; |
144 |
|
case '2': |
145 |
|
array_push($exif_headers, 'Flash: Off'); |
146 |
|
break; |
147 |
|
case '3': |
148 |
|
array_push($exif_headers, 'Flash: Red-Eye Reduction'); |
149 |
|
break; |
150 |
|
default: |
151 |
|
array_push($exif_headers, 'Flash: Unknown'); |
152 |
|
break; |
153 |
} |
} |
154 |
break; |
break; |
155 |
|
case 'FocusMode': |
156 |
|
|
157 |
|
switch($exif_value) { |
158 |
|
case '0': |
159 |
|
array_push($exif_headers, 'Focus: C-AF/S-AF'); |
160 |
|
break; |
161 |
|
case '1': |
162 |
|
array_push($exif_headers, 'Focus: MF'); |
163 |
|
break; |
164 |
|
default: |
165 |
|
break; |
166 |
|
} |
167 |
|
break; |
168 |
|
case 'ISOSpeedRatings'; |
169 |
|
array_push($exif_headers, 'ISO: '.$exif_value); |
170 |
|
break; |
171 |
default: |
default: |
172 |
break; |
break; |
173 |
} |
} |
|
} |
|
174 |
} |
} |
175 |
} |
} |
176 |
if(sizeof($exif_headers)>0) { |
if(sizeof($exif_headers)>0) { |
253 |
if(file_exists($image)) { |
if(file_exists($image)) { |
254 |
|
|
255 |
$image_size = GetImageSize($image); |
$image_size = GetImageSize($image); |
256 |
|
$src_image_size = $image_size; |
257 |
|
|
258 |
if(isset($get_var['width'])) { |
if(isset($get_vars['width'])) { |
259 |
if($get_var['width'] >= $image_size[0]) |
|
260 |
|
$cache_size = split("x",$get_vars['width']); |
261 |
|
|
262 |
|
if($cache_size[0] >= $src_image_size[0]) { |
263 |
$cache_image = $image; |
$cache_image = $image; |
264 |
|
} else { |
265 |
|
if(array_search($get_vars['width'], $global_var['image_sz']['valid_sizes'])) { |
266 |
|
if(!file_exists($pwd.'/.cache/'.$get_vars['width'].'_'.$get_vars['img'])) { |
267 |
|
resize_image($get_vars['width'].'_'); |
268 |
|
} |
269 |
|
$cached_image = $pwd.'/.cache/'.$get_vars['width'].'_'.$get_vars['img']; |
270 |
|
} |
271 |
|
if($cache_size[0] == $global_var['image_sz']['default']['x']) |
272 |
|
$cached_image = $cached_image.'/default_'.$get_vars['img']; |
273 |
|
} |
274 |
|
|
275 |
} else { |
} else { |
276 |
if(!file_exists($cached_image.'/default_'.$get_vars['img'])) { |
if(!file_exists($cached_image.'/default_'.$get_vars['img'])) { |
277 |
resize_image('default_'); |
resize_image('default_'); |
278 |
|
|
279 |
} |
} |
280 |
$cached_image = $cached_image.'/default_'.$get_vars['img']; |
$cached_image = $cached_image.'/default_'.$get_vars['img']; |
281 |
|
|
282 |
} |
} |
283 |
|
|
284 |
$image_size = GetImageSize($cached_image); |
$image_size = GetImageSize($cached_image); |
311 |
$image_index = get_image_index(); |
$image_index = get_image_index(); |
312 |
$next = get_next_image($image_index); |
$next = get_next_image($image_index); |
313 |
$prev = get_prev_image($image_index); |
$prev = get_prev_image($image_index); |
314 |
|
|
315 |
|
echo <<<EOT |
316 |
|
<span style="font-weight: bold;">Size:</span> |
317 |
|
EOT; |
318 |
|
|
319 |
|
foreach($global_var['image_sz']['valid_sizes'] as $new_size) { |
320 |
|
|
321 |
|
if($get_vars['width'] == $new_size) { |
322 |
|
echo $new_size; |
323 |
|
} elseif($cache_size[0] >= $src_image_size[0]) { |
324 |
|
} else { |
325 |
|
|
326 |
|
echo <<<EOT |
327 |
|
<a href="$php_self?dir=$pwd&img={$get_vars[img]}&width=$new_size">$new_size</a> |
328 |
|
EOT; |
329 |
|
} |
330 |
|
|
331 |
|
} |
332 |
|
|
333 |
|
echo <<<EOT |
334 |
|
<a href="$pwd/{$get_vars[img]}" target="_blank">{$src_image_size[0]}x{$src_image_size[1]}</a> |
335 |
|
EOT; |
336 |
|
|
337 |
echo <<<EOT |
echo <<<EOT |
338 |
<a href="$php_self?dir=$pwd&img=$prev">prev</a> |
<div>\n |
339 |
<a href="$php_self?dir=$pwd&img=$next">next</a> |
<a href="$php_self?dir=$pwd&img=$prev">prev</a> |
340 |
|
<a href="$php_self?dir=$pwd&img=$next">next</a>\n |
341 |
|
</div>\n |
342 |
EOT; |
EOT; |
343 |
|
|
344 |
} |
} |
355 |
|
|
356 |
if(isset($global_var['external']['magick'])) { |
if(isset($global_var['external']['magick'])) { |
357 |
if(file_exists($pwd.'/'.$src_image)) { |
if(file_exists($pwd.'/'.$src_image)) { |
358 |
|
|
359 |
$src_image_sz = GetImageSize($pwd.'/'.$src_image); |
$src_image_sz = GetImageSize($pwd.'/'.$src_image); |
360 |
$resize_aspect = round(($global_var['image_sz']['default']['y'] / $src_image_sz[1])*100, 2); |
$resize_aspect = round(($global_var['image_sz']['default']['y'] / $src_image_sz[1])*100, 2); |
361 |
|
$resize_quality = $global_var['image_sz']['default']['ql']; |
362 |
|
|
363 |
|
if(isset($get_vars['width'])) { |
364 |
|
$new_width = split("x", $get_vars['width']); |
365 |
|
$resize_aspect = round(($new_width[1] / $src_image_sz[1])*100, 2); |
366 |
|
} |
367 |
|
|
368 |
// DEBUG: print "Quality: ".$global_var['image_sz']['default']['ql'] ." Resize Aspect: ". $resize_aspect ."%"; |
// DEBUG: print "Quality: ".$global_var['image_sz']['default']['ql'] ." Resize Aspect: ". $resize_aspect ."%"; |
369 |
|
|
370 |
if(!file_exists($cache_dir)) |
if(!file_exists($cache_dir)) |
371 |
mkdir($cache_dir,0777); |
mkdir($cache_dir,0777); |
372 |
|
|
373 |
|
$debug = array(); |
374 |
|
|
375 |
exec($global_var['external']['magick'] |
exec($global_var['external']['magick'] |
376 |
.' -geometry '.$resize_aspect.'%' |
.' -geometry '.$resize_aspect.'%' |
377 |
.' -quality '.$global_var['image_sz']['default']['ql'] |
.' -quality '.$resize_quality |
378 |
.' '.$pwd.'/'.$src_image |
.' '.$pwd.'/'.$src_image |
379 |
.' '.$pwd.'/'.$global_var['path']['cache_dir'].'/'.$prefix.$src_image |
.' '.$pwd.'/'.$global_var['path']['cache_dir'].'/'.$prefix.$src_image, $debug, $ret_val |
380 |
); |
); |
381 |
|
|
382 |
|
print_r($debug); |
383 |
} |
} |
384 |
} |
} |
385 |
} |
} |
480 |
|
|
481 |
|
|
482 |
|
|
483 |
|
function create_directory_browser() |
484 |
|
{ |
485 |
|
global $pwd, $dir_files; |
486 |
|
|
487 |
|
if(sizeof($dir_files)>0) { |
488 |
|
|
489 |
|
foreach($dir_files as $dir) { |
490 |
|
|
491 |
|
$dir_image = 'open.png'; |
492 |
|
|
493 |
|
if(file_exists($pwd.'/'.$dir.'/.htaccess')) |
494 |
|
$dir_image = 'protected.png'; |
495 |
|
|
496 |
|
echo <<<EOT |
497 |
|
<div style="text-align: center;">\n |
498 |
|
<a href="$php_self?dir=$pwd/$dir">\n |
499 |
|
<img src="../images/$dir_image" alt=""/><br/>$dir\n |
500 |
|
</a>\n |
501 |
|
</div>\n |
502 |
|
EOT; |
503 |
|
} |
504 |
|
} |
505 |
|
} |
506 |
|
|
507 |
|
|
508 |
|
|
509 |
|
|
510 |
|
|
511 |
|
|
512 |
if (isset($get_vars['dir']) && is_dir(rawurldecode($get_vars['dir']))) |
if (isset($get_vars['dir']) && is_dir(rawurldecode($get_vars['dir']))) |
513 |
{ |
{ |
528 |
|
|
529 |
if(sizeof($image_files) <= 0) { |
if(sizeof($image_files) <= 0) { |
530 |
if(sizeof($dir_files) > 0) { |
if(sizeof($dir_files) > 0) { |
531 |
|
create_directory_browser(); |
532 |
} else { |
} else { |
533 |
} |
} |
534 |
} else { |
} else { |
541 |
} |
} |
542 |
} |
} |
543 |
|
|
544 |
|
|
545 |
|
|
546 |
|
|
547 |
// print the html footer to make it nice and tidy. |
// print the html footer to make it nice and tidy. |
548 |
html_template_footer(); |
html_template_footer(); |
549 |
|
|
612 |
echo <<<EOF |
echo <<<EOF |
613 |
<div id="copyright">\n |
<div id="copyright">\n |
614 |
{$global_var[str_msg][copyright]}<br />\n |
{$global_var[str_msg][copyright]}<br />\n |
615 |
<a href="">expose</a>\n <span style="font-style: italic;">\$Revision$</span>\n |
<span style="font-style: italic;">\$Revision$</span>\n |
616 |
</div>\n\n |
</div>\n\n |
617 |
</div>\n |
</div>\n |
618 |
</body>\n |
</body>\n |
654 |
} |
} |
655 |
} |
} |
656 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function html_template_alt_resolutions() |
|
|
{ |
|
|
} |
|
657 |
?> |
?> |