forked from SDFIdk/arkiv_meta_client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewImage.php
73 lines (67 loc) · 2.43 KB
/
viewImage.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
<?php
include_once __DIR__.'/Classes/KFProxy.php';
include_once __DIR__.'/Classes/Document.php';
$msg = [];
$input = filter_input_array(INPUT_GET);
$id = isset($input['id']) ? filter_var($input['id'], FILTER_SANITIZE_STRING) : "InvalidId";
$imageUrl = isset($input['imageUrl']) ? filter_var($input['imageUrl'], FILTER_SANITIZE_STRING) : null;
// Get IIIF tile info by following URL
$proxy = new KFProxy($imageUrl);
$tileInfo = $proxy->getData();
if(!isset($tileInfo) || $tileInfo === false) {
$msg[] = "Kunne ikke hente data fra " . $proxy->getUrl();
}
// Get other metadata
$proxy->setUrl($proxy->getHost() . "/rest/arkivmeta/kort/" . $id);
$otherInfo = $proxy->getData();
$document = new Document("Arkivdata");
$document->generateDocumentStartHTML(["js/openseadragon-bin-2.4.0/openseadragon.min.js"]);
?>
<h1><?php echo $otherInfo["titel"];?></h1>
<?php if($msg) { ?>
<div class="row">
<div class="col-md-12">
<div class="alert alert-warning">
<button type="button" class="close" data-dismiss="alert">×</button>
<h4>Fejl</h4>
<p><?php echo implode("<br>",$msg);?></p>
</div>
</div>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<div>
<?php
foreach($otherInfo as $key=>$val) {
$val = ($key=="daekningsomraade" || $key=="filer") ? implode(",", $val) : $val;
echo "<span><b>" . $key . ":</b> " . $val . "</span> ";
}
?>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="openseadragon"></div>
</div>
</div>
<script type="text/javascript">
var viewer = OpenSeadragon({
id: "openseadragon",
preserveViewport: true,
visibilityRatio: 1,
minZoomLevel: 1,
defaultZoomLevel: 1,
sequenceMode: true,
prefixUrl: "js/openseadragon-bin-2.4.0/images/",
tileSources: [<?php echo json_encode($tileInfo);?>],
loadTilesWithAjax: true,
ajaxHeaders: {
"token": "<?php echo $proxy->getToken();?>"
}
});
</script>
<?php
$document->generateDocumentEndHTML();
?>