| 62 |
|
|
| 63 |
$global_var['image_sz']['default'] =& $global_var['image_sz']['640']; |
$global_var['image_sz']['default'] =& $global_var['image_sz']['640']; |
| 64 |
|
|
| 65 |
|
$global_var['exif'] = array ( |
| 66 |
|
'Make', |
| 67 |
|
'ApertureFNumber', |
| 68 |
|
'FocalLength', |
| 69 |
|
'DateTime', |
| 70 |
|
'FlashMode' |
| 71 |
|
); |
| 72 |
|
$exif_headers = array (); |
| 73 |
|
|
| 74 |
|
|
| 75 |
if(isset($_SERVER['PHP_SELF'])) { |
if(isset($_SERVER['PHP_SELF'])) { |
| 76 |
$php_self = $_SERVER['PHP_SELF']; |
$php_self = $_SERVER['PHP_SELF']; |
| 77 |
} else { |
} else { |
| 95 |
*/ |
*/ |
| 96 |
function extract_exif_data() |
function extract_exif_data() |
| 97 |
{ |
{ |
| 98 |
|
global $global_var, $pwd, $get_vars, $exif_headers; |
| 99 |
|
|
| 100 |
|
$src_image = $get_vars['img']; |
| 101 |
|
$exif_data = @exif_read_data($pwd.'/'.$src_image,0,true); |
| 102 |
|
|
| 103 |
|
if($exif_data) { |
| 104 |
|
|
| 105 |
|
foreach($exif_data as $exif_section_key => $exif_section) { |
| 106 |
|
foreach($exif_section as $exif_key => $exif_value) { |
| 107 |
|
|
| 108 |
|
if(array_search($exif_key, $global_var['exif'])) { |
| 109 |
|
|
| 110 |
|
switch($exif_key) { |
| 111 |
|
case 'Make': |
| 112 |
|
array_push($exif_headers, 'Model: '.$exif_value); |
| 113 |
|
break; |
| 114 |
|
|
| 115 |
|
case 'ApertureFNumber': |
| 116 |
|
array_push($exif_headers, 'Aperture: '. $exif_value); |
| 117 |
|
break; |
| 118 |
|
|
| 119 |
|
case 'FocalLength': |
| 120 |
|
array_push($exif_headers, 'Focal Length: '. $exif_value .'mm'); |
| 121 |
|
break; |
| 122 |
|
|
| 123 |
|
case 'DateTime': |
| 124 |
|
array_push($exif_headers, 'Date: '.$exif_value); |
| 125 |
|
break; |
| 126 |
|
|
| 127 |
|
case 'FlashMode': |
| 128 |
|
switch($exif_value) { |
| 129 |
|
case '0': |
| 130 |
|
array_push($exif_headers, 'Flash: Off'); |
| 131 |
|
break; |
| 132 |
|
case '1': |
| 133 |
|
array_push($exif_headers, 'Flash: On'); |
| 134 |
|
break; |
| 135 |
|
} |
| 136 |
|
break; |
| 137 |
|
|
| 138 |
|
default: |
| 139 |
|
break; |
| 140 |
|
} |
| 141 |
|
} |
| 142 |
|
} |
| 143 |
|
} |
| 144 |
|
if(sizeof($exif_headers)>0) { |
| 145 |
|
ksort($exif_headers); |
| 146 |
|
reset($exif_headers); |
| 147 |
|
} |
| 148 |
|
} |
| 149 |
} |
} |
| 150 |
|
|
| 151 |
|
|
| 212 |
|
|
| 213 |
function show_image() |
function show_image() |
| 214 |
{ |
{ |
| 215 |
global $global_var, $get_vars, $pwd; |
global $global_var, $get_vars, $pwd, $exif_headers; |
| 216 |
|
|
| 217 |
$image = $pwd.'/'.$get_vars['img']; |
$image = $pwd.'/'.$get_vars['img']; |
| 218 |
|
|
| 233 |
} |
} |
| 234 |
|
|
| 235 |
$image_size = GetImageSize($cached_image); |
$image_size = GetImageSize($cached_image); |
| 236 |
|
|
| 237 |
|
extract_exif_data(); |
| 238 |
|
|
| 239 |
|
if(sizeof($exif_headers) > 0) { |
| 240 |
|
|
| 241 |
|
$exif_str .= sprintf("<span style=\"font-weight: bold;\">EXIF</span> "); |
| 242 |
|
|
| 243 |
|
foreach($exif_headers as $exif_tag) { |
| 244 |
|
$exif_str .= sprintf("| %s ", $exif_tag); |
| 245 |
|
} |
| 246 |
|
|
| 247 |
|
echo <<<EOT |
| 248 |
|
<div id="exif_headers">\n |
| 249 |
|
<span>$exif_str</span>\n |
| 250 |
|
</div>\n |
| 251 |
|
EOT; |
| 252 |
|
|
| 253 |
|
} |
| 254 |
|
|
| 255 |
|
|
| 256 |
echo <<<EOT |
echo <<<EOT |
| 257 |
<div id="image" style="width: {$image_size[0]}px; height: {$image_size[1]}px;">\n |
<div id="image" style="width: {$image_size[0]}px; height: {$image_size[1]}px;">\n |
| 258 |
<a href="$image" target="_blank"><img src="$cached_image" alt=""></a> |
<a href="$image" target="_blank"><img src="$cached_image" alt=""></a> |
| 259 |
</div>\n |
</div>\n |
| 260 |
EOT; |
EOT; |
| 261 |
|
|
| 262 |
|
$image_index = get_image_index(); |
| 263 |
|
$next = get_next_image($image_index); |
| 264 |
|
$prev = get_prev_image($image_index); |
| 265 |
|
|
| 266 |
|
echo <<<EOT |
| 267 |
|
<a href="$php_self?dir=$pwd&img=$prev">prev</a> |
| 268 |
|
<a href="$php_self?dir=$pwd&img=$next">next</a> |
| 269 |
|
EOT; |
| 270 |
|
|
| 271 |
} |
} |
| 272 |
} |
} |
| 273 |
|
|
| 296 |
} |
} |
| 297 |
|
|
| 298 |
|
|
| 299 |
|
|
| 300 |
|
|
| 301 |
|
function get_image_index() |
| 302 |
|
{ |
| 303 |
|
global $get_vars, $image_files; |
| 304 |
|
|
| 305 |
|
return array_search($get_vars['img'], $image_files); |
| 306 |
|
} |
| 307 |
|
|
| 308 |
|
function get_next_image($pos) |
| 309 |
|
{ |
| 310 |
|
global $get_vars, $image_files; |
| 311 |
|
|
| 312 |
|
$next = $pos + 1; |
| 313 |
|
|
| 314 |
|
if($next >= sizeof($image_files)) |
| 315 |
|
$next = 0; |
| 316 |
|
|
| 317 |
|
return $image_files[$next]; |
| 318 |
|
} |
| 319 |
|
|
| 320 |
|
function get_prev_image($pos) |
| 321 |
|
{ |
| 322 |
|
global $get_vars, $image_files; |
| 323 |
|
|
| 324 |
|
$prev = $pos - 1; |
| 325 |
|
|
| 326 |
|
if($prev < 0) |
| 327 |
|
$prev = sizeof($image_files) - 1; |
| 328 |
|
|
| 329 |
|
return $image_files[$prev]; |
| 330 |
|
} |
| 331 |
|
|
| 332 |
/** |
/** |
| 333 |
* Retirieves all filenames that are images exclude all |
* Retirieves all filenames that are images exclude all |
| 334 |
* other files. It's not recursive so it only examins the |
* other files. It's not recursive so it only examins the |
| 453 |
</head> |
</head> |
| 454 |
|
|
| 455 |
<body> |
<body> |
| 456 |
|
<div id="header">\n |
| 457 |
|
<h1>expose:</h1> |
| 458 |
|
<span style="font-style: italic;"></span> |
| 459 |
|
</div>\n |
| 460 |
<div id="container">\n |
<div id="container">\n |
| 461 |
EOF; |
EOF; |
| 462 |
} |
} |