-
Notifications
You must be signed in to change notification settings - Fork 2
/
TEST.html
43 lines (39 loc) · 1.4 KB
/
TEST.html
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
<script>
function initializeViewer(imageSrc) {
if (viewer) {
viewer.destroy();
}
viewer = OpenSeadragon({
id: "viewer",
prefixUrl: "https://cdnjs.cloudflare.com/ajax/libs/openseadragon/4.1.0/images/",
tileSources: {
type: 'image',
url: imageSrc || 'path_to_default_image_or_IIIF_source',
buildPyramid: true, // Enable pyramidal TIFF support
tileSize: 256, // Set tile size for pyramidal images
crossOriginPolicy: 'Anonymous',
formats: ["tiff", "jpeg", "jpg", "png"] // Add TIFF support
},
showNavigationControl: false,
maxZoomPixelRatio: 10,
gestureSettingsMouse: {
clickToZoom: false
}
});
viewer.addHandler('zoom', function() {
updateZoomLevel();
});
}
document.getElementById('image-upload').addEventListener('change', function(e) {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
initializeViewer(event.target.result);
displayFileName(file.name);
};
reader.readAsDataURL(file); // This will work for non-TIFF images.
}
});
initializeViewer();
</script>