You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

554 lines
21 KiB

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