-
Notifications
You must be signed in to change notification settings - Fork 77
/
detail.php
executable file
·553 lines (466 loc) · 20.8 KB
/
detail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
<?php
/**
* DokuWiki Bootstrap3 Template: Image Detail Page
*
* @link http://dokuwiki.org/template:bootstrap3
* @author Andreas Gohr <andi@splitbrain.org>
* @author Anika Henke <anika@selfthinker.org>
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/
if (!defined('DOKU_INC')) die(); // must be run from within DokuWiki
require_once('tpl/global.php');
require_once('tpl/functions.php');
global $ACT;
global $conf;
global $ERROR;
global $IMG;
global $INPUT;
global $lang;
global $TPL;
global $REV;
header('X-UA-Compatible: IE=edge,chrome=1');
$metadata = array(
'exif' => array(
'Exif.ImageDescription',
'Exif.Make',
'Exif.Model',
'Exif.Orientation',
'Exif.XResolution',
'Exif.YResolution',
'Exif.ResolutionUnit',
'Exif.Software',
'Exif.DateTime',
'Exif.Artist',
'Exif.WhitePoint',
'Exif.PrimaryChromaticities',
'Exif.YCbCrCoefficients',
'Exif.YCbCrSubSampling',
'Exif.YCbCrPositioning',
'Exif.ReferenceBlackWhite',
'Exif.Copyright',
'Exif.ExifIFDOffset',
'Exif.GPSIFDOffset',
'Exif.TIFFNewSubfileType',
'Exif.TIFFSubfileType',
'Exif.TIFFImageWidth',
'Exif.TIFFImageHeight',
'Exif.TIFFBitsPerSample',
'Exif.TIFFCompression',
'Exif.TIFFPhotometricInterpretation',
'Exif.TIFFThreshholding',
'Exif.TIFFCellWidth',
'Exif.TIFFCellLength',
'Exif.TIFFFillOrder',
'Exif.TIFFImageDescription',
'Exif.TIFFMake',
'Exif.TIFFModel',
'Exif.TIFFStripOffsets',
'Exif.TIFFOrientation',
'Exif.TIFFSamplesPerPixel',
'Exif.TIFFRowsPerStrip',
'Exif.TIFFStripByteCounts',
'Exif.TIFFMinSampleValue',
'Exif.TIFFMaxSampleValue',
'Exif.TIFFXResolution',
'Exif.TIFFYResolution',
'Exif.TIFFPlanarConfiguration',
'Exif.TIFFGrayResponseUnit',
'Exif.TIFFGrayResponseCurve',
'Exif.TIFFResolutionUnit',
'Exif.TIFFSoftware',
'Exif.TIFFDateTime',
'Exif.TIFFArtist',
'Exif.TIFFHostComputer',
'Exif.TIFFColorMap',
'Exif.TIFFExtraSamples',
'Exif.TIFFJFIFOffset',
'Exif.TIFFJFIFLength',
'Exif.TIFFYCbCrCoefficients',
'Exif.TIFFYCbCrSubSampling',
'Exif.YCbCrPositioning',
'Exif.ReferenceBlackWhite',
'Exif.Copyright',
'Exif.ExifIFDOffset',
'Exif.GPSIFDOffset',
'Exif.TIFFNewSubfileType',
'Exif.TIFFSubfileType',
'Exif.TIFFImageWidth',
'Exif.TIFFImageHeight',
'Exif.TIFFBitsPerSample',
'Exif.TIFFCompression',
'Exif.TIFFPhotometricInterpretation',
'Exif.TIFFThreshholding',
'Exif.TIFFCellWidth',
'Exif.TIFFCellLength',
'Exif.TIFFFillOrder',
'Exif.TIFFImageDescription',
'Exif.TIFFMake',
'Exif.TIFFModel',
'Exif.TIFFStripOffsets',
'Exif.TIFFOrientation',
'Exif.TIFFSamplesPerPixel',
'Exif.TIFFRowsPerStrip',
'Exif.TIFFStripByteCounts',
'Exif.TIFFMinSampleValue',
'Exif.TIFFMaxSampleValue',
'Exif.TIFFXResolution',
'Exif.TIFFYResolution',
'Exif.TIFFPlanarConfiguration',
'Exif.TIFFGrayResponseUnit',
'Exif.TIFFGrayResponseCurve',
'Exif.TIFFResolutionUnit',
'Exif.TIFFSoftware',
'Exif.TIFFDateTime',
'Exif.TIFFArtist',
'Exif.TIFFHostComputer',
'Exif.TIFFColorMap',
'Exif.TIFFExtraSamples',
'Exif.TIFFJFIFOffset',
'Exif.TIFFJFIFLength',
'Exif.TIFFYCbCrCoefficients',
'Exif.TIFFYCbCrSubSampling',
'Exif.TIFFYCbCrPositioning',
'Exif.TIFFReferenceBlackWhite',
'Exif.TIFFCopyright',
'Exif.TIFFUserComment',
'Exif.ExposureTime',
'Exif.FNumber',
'Exif.ExposureProgram',
'Exif.SpectralSensitivity',
'Exif.ISOSpeedRatings',
'Exif.OECF',
'Exif.EXIFVersion',
'Exif.DatetimeOriginal',
'Exif.DatetimeDigitized',
'Exif.ComponentsConfiguration',
'Exif.CompressedBitsPerPixel',
'Exif.ShutterSpeedValue',
'Exif.ApertureValue',
'Exif.BrightnessValue',
'Exif.ExposureBiasValue',
'Exif.MaxApertureValue',
'Exif.SubjectDistance',
'Exif.MeteringMode',
'Exif.LightSource',
'Exif.Flash',
'Exif.FocalLength',
//'Exif.MakerNote',
'Exif.UserComment',
'Exif.SubSecTime',
'Exif.SubSecTimeOriginal',
'Exif.SubSecTimeDigitized',
'Exif.FlashPixVersion',
'Exif.ColorSpace',
'Exif.PixelXDimension',
'Exif.PixelYDimension',
'Exif.RelatedSoundFile',
'Exif.InteropIFDOffset',
'Exif.FlashEnergy',
'Exif.SpatialFrequencyResponse',
'Exif.FocalPlaneXResolution',
'Exif.FocalPlaneYResolution',
'Exif.FocalPlaneResolutionUnit',
'Exif.SubjectLocation',
'Exif.ExposureIndex',
'Exif.SensingMethod',
'Exif.FileSource',
'Exif.SceneType',
'Exif.CFAPattern',
'Exif.InteroperabilityIndex',
'Exif.InteroperabilityVersion',
'Exif.RelatedImageFileFormat',
'Exif.RelatedImageWidth',
'Exif.RelatedImageLength',
'Exif.GPSVersionID',
'Exif.GPSLatitudeRef',
'Exif.GPSLatitude',
'Exif.GPSLongitudeRef',
'Exif.GPSLongitude',
'Exif.GPSAltitudeRef',
'Exif.GPSAltitude',
'Exif.GPSTimeStamp',
'Exif.GPSSatellites',
'Exif.GPSStatus',
'Exif.GPSMeasureMode',
'Exif.GPSDOP',
'Exif.GPSSpeedRef',
'Exif.GPSSpeed',
'Exif.GPSTrackRef',
'Exif.GPSTrack',
'Exif.GPSImgDirectionRef',
'Exif.GPSImgDirection',
'Exif.GPSMapDatum',
'Exif.GPSDestLatitudeRef',
'Exif.GPSDestLatitude',
'Exif.GPSDestLongitudeRef',
'Exif.GPSDestLongitude',
'Exif.GPSDestBearingRef',
'Exif.GPSDestBearing',
'Exif.GPSDestDistanceRef',
'Exif.GPSDestDistance',
),
'iptc' => array(
'Iptc.SuplementalCategories',
'Iptc.Keywords',
'Iptc.Caption',
'Iptc.CaptionWriter',
'Iptc.Headline',
'Iptc.SpecialInstructions',
'Iptc.Category',
'Iptc.Byline',
'Iptc.BylineTitle',
'Iptc.Credit',
'Iptc.Source',
'Iptc.CopyrightNotice',
'Iptc.ObjectName',
'Iptc.City',
'Iptc.Province State',
'Iptc.CountryName',
'Iptc.OriginalTransmissionReference',
'Iptc.DateCreated',
'Iptc.CopyrightFlag',
),
);
$maxwidth = 800;
$maxheight = 600;
$originalwidth = $w = (int) tpl_img_getTag('File.Width');
$originalheight = $h = (int) tpl_img_getTag('File.Height');
//resize to given max values
$ratio = 1;
if ($w >= $h) {
if ($maxwidth && $w >= $maxwidth) {
$ratio = $maxwidth / $w;
} elseif ($maxheight && $h > $maxheight) {
$ratio = $maxheight / $h;
}
} else {
if ($maxheight && $h >= $maxheight) {
$ratio = $maxheight / $h;
} elseif ($maxwidth && $w > $maxwidth) {
$ratio = $maxwidth / $w;
}
}
if ($ratio) {
$w = floor($ratio * $w);
$h = floor($ratio * $h);
}
$other_sizes = array();
foreach (array(0.1, 0.25, 0.5, 0.75, 1) as $ratio) {
$other_sizes[] = array(
'w' => floor($ratio * $originalwidth),
'h' => floor($ratio * $originalheight),
'ratio' => $ratio,
);
}
$show_metadata = false;
?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo $conf['lang']?>" dir="<?php echo $lang['direction'] ?>" class="no-js">
<head>
<meta charset="UTF-8" />
<title><?php echo hsc(tpl_img_getTag('IPTC.Headline',$IMG))?> [<?php echo strip_tags($conf['title'])?>]</title>
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<?php
if ($TPL->getConf('themeByNamespace')) {
echo '<link href="' . tpl_basedir() . 'css.php?id='. $ID .'" rel="stylesheet" />';
}
echo tpl_favicon(array('favicon', 'mobile'));
tpl_includeFile('meta.html');
tpl_metaheaders();
?>
<!--[if lt IE 9]>
<script type="text/javascript" src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script type="text/javascript" src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="<?php echo $TPL->getClasses() ?>" data-img-id="<?php echo $IMG ?>"><div class="dokuwiki"><?php /* CSS class for Plugins and user styles */ ?>
<header id="dokuwiki__header" class="dw-container dokuwiki container<?php echo ($TPL->getConf('fluidContainer')) ? '-fluid' : '' ?>">
<?php
tpl_includeFile('topheader.html');
// Top-Header DokuWiki page
if ($ACT == 'show') echo $TPL->includePage('topheader');
require_once('tpl/navbar.php');
tpl_includeFile('header.html');
// Header DokuWiki page
if ($ACT == 'show') echo $TPL->includePage('header');
?>
</header>
<a name="dokuwiki__top" id="dokuwiki__top"></a>
<main role="main" class="dw-container pb-5 dokuwiki container<?php echo ($TPL->getConf('fluidContainer')) ? '-fluid mx-5' : '' ?>">
<div id="dokuwiki__pageheader">
<?php tpl_includeFile('social.html') ?>
<?php require_once('tpl/breadcrumbs.php'); ?>
<p class="text-right">
<?php if($TPL->getConf('showPageId')): ?>
<span class="pageId ml-1 label label-primary"><?php echo hsc(tpl_img_getTag('IPTC.Headline',$IMG)); ?></span>
<?php endif; ?>
</p>
<div id="dw__msgarea" class="small">
<?php $TPL->getMessageArea() ?>
</div>
</div>
<div class="">
<article id="dokuwiki__detail">
<?php require_once('tpl/page-tools.php'); // Page Tools ?>
<div class="dokuwiki panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<?php echo iconify('mdi:image', array('class' => 'text-muted')) ?> <?php echo nl2br(hsc(tpl_img_getTag('simple.title'))); ?>
</h3>
</div>
<div class="page panel-body">
<?php require_once('tpl/page-icons.php'); ?>
<?php if ($ERROR): print '<h1>' . iconify('mdi:alert', array('class' => 'mr-2', 'style' => 'color:orange')) . $ERROR . '</h1>'; ?>
<?php else: ?>
<?php if ($REV) echo p_locale_xhtml('showrev'); ?>
<div class="row">
<div class="col-sm-8">
<p class="px-2">
<?php tpl_img($maxwidth, $maxheight); /* the image; parameters: maximum width, maximum height (and more) */ ?>
</p>
<p class="small my-2">
<?php echo iconify('mdi:image-size-select-large'); ?> <?php echo tpl_getLang('preview_size') ?>: <a href="<?php echo ml($IMG, array('cache' => $INPUT->str('cache'), 'rev' => $REV, 'w' => $w, 'h' => $h), true, '&'); ?>"><?php echo $w; ?> × <?php echo $h; ?></a> pixels.
<?php echo tpl_getLang('other_resolutions') ?>: <?php foreach ($other_sizes as $size): ?> <a href="<?php echo ml($IMG, array('cache' => $INPUT->str('cache'), 'rev' => $REV, 'w' => $size['w'], 'h' => $size['h']), true, '&'); ?>" title="<?php echo floor($size['ratio'] * 100); ?>%"><?php echo $size['w']; ?> × <?php echo $size['h']; ?></a> pixels <?php endforeach; ?>
</p>
<p class="image-info my-3">
<?php echo iconify('mdi:image'); ?> <a href="<?php echo ml($IMG, array('cache'=> $INPUT->str('cache'),'rev'=>$REV), true, '&'); ?>" target="_blank" title="<?php echo $lang['js']['mediadirect']; ?>"><?php echo hsc(tpl_img_getTag('IPTC.Headline',$IMG)); ?></a> ( <?php echo tpl_img_getTag('File.Width'); ?> × <?php echo tpl_img_getTag('File.Height'); ?> pixels )
</p>
</div>
<div class="col-sm-4">
<div class="image-information">
<h3 class="pb-4">
<?php echo iconify('mdi:information', array('class' => 'text-primary')) ?> Information
</h3>
<div class="table-responsive">
<table class="table table-condensed table-striped">
<tbody>
<?php
$tags = tpl_get_img_meta();
foreach($tags as $tag) {
$label = $lang[$tag['langkey']];
if(!$label) $label = $tag['langkey'] . ':';
echo '<tr><th>'.$label.'</th><td>';
if ($tag['type'] == 'date') {
echo dformat($tag['value']);
} else {
echo hsc($tag['value']);
}
echo '</td></tr>';
}
?>
</tbody>
</table>
</div>
<?php
//Comment in for Debug
//dbg(tpl_img_getTag('Simple.Raw'));
?>
</div>
<div class="image-reference pt-4">
<h3 class="pb-4">
<?php echo iconify('mdi:link-variant'); ?> <?php echo $lang['reference']; ?>
</h3>
<?php
$media_usage = ft_mediause($IMG, true);
if (count($media_usage) > 0) {
echo '<ul>';
foreach($media_usage as $path){
echo '<li>'.html_wikilink($path).'</li>';
}
echo '</ul>';
} else {
echo '<p>'.$lang['nothingfound'].'</p>';
}
?>
<?php if (isset($lang['media_acl_warning'])): // This message is available from release 2015-08-10 "Detritus" ?>
<div class="alert alert-warning">
<?php echo iconify('mdi:alert'); ?> <?php echo $lang['media_acl_warning']; ?>
</div>
<?php endif; ?>
</div>
<div class="image-metadata pt-4 hide">
<h3 class="pb-4">
<?php echo iconify('mdi:code-tags', array('class' => 'text-success')); ?> Metadata
</h3>
<div class="metadata">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#exif">Exif</a></li>
<li><a data-toggle="tab" href="#iptc">IPTC</a></li>
</ul>
<div class="tab-content">
<?php $active = 'active in'; foreach ($metadata as $section => $items): ?>
<div id="<?php echo $section; ?>" class="tab-pane fade <?php echo $active; ?>">
<div class="table-responsive">
<table class="table table-condensed table-striped">
<?php
foreach ($items as $tag) {
$value = tpl_img_getTag($tag);
$name = str_ireplace("$section.", '', $tag);
if ($value !== '') {
echo "<tr><th title='$tag'>$name</th><td>$value</td></tr>";
$show_metadata = true;
}
}
$active = '';
?>
</table>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php if ($show_metadata): ?>
<script>
window.addEventListener('DOMContentLoaded', function() {
jQuery('.image-metadata').removeClass('hide');
});
</script>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
<div class="small text-right">
<?php if ($TPL->getConf('showPageInfo')): ?>
<span class="docInfo">
<?php $TPL->getPageInfo() /* 'Last modified' etc */ ?>
</span>
<?php endif ?>
<?php if ($TPL->getConf('showLoginOnFooter')): ?>
<span class="loginLink hidden-print">
<?php
if ($login_item = $TPL->getToolMenuItem('user', 'login')) {
echo '<a '. buildAttributes($login_item->getLinkAttributes()) .'>'. inlineSVG($login_item->getSvg()) . ' ' . hsc($login_item->getLabel()) .'</a>';
}
?>
</span>
<?php endif; ?>
</div>
</article>
</div>
</main>
<footer id="dw__footer" class="dw-container py-5 dokuwiki container<?php echo ($TPL->getConf('fluidContainer')) ? '-fluid' : '' ?>">
<?php
// Footer hook
tpl_includeFile('footer.html');
// Footer DokuWiki page
require_once('tpl/footer.php');
// Cookie-Law banner
require_once('tpl/cookielaw.php');
?>
</footer>
<a href="#dokuwiki__top" class="back-to-top hidden-print btn btn-default btn-sm" title="<?php echo $lang['skip_to_content'] ?>" accesskey="t">
<?php echo iconify('mdi:chevron-up'); ?>
</a>
<div id="screen__mode"><?php /* helper to detect CSS media query in script.js */ ?>
<span class="visible-xs-block"></span>
<span class="visible-sm-block"></span>
<span class="visible-md-block"></span>
<span class="visible-lg-block"></span>
</div>
</div>
</body>
</html>