Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/nop 21/static images #64

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ jobs:
cypress:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/checkout@v4
- run: cksum src/components/DLViewer.vue
- uses: actions/setup-node@v3
with:
node-version: 16
Expand All @@ -24,7 +25,7 @@ jobs:
# needs: cypress
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
Expand All @@ -51,6 +52,8 @@ jobs:
fi
- run: npm install && npm run build
if: env.DESTINATION_DIR
- run: ls -R dist
if: env.DESTINATION_DIR
- name: deploy
if: env.DESTINATION_DIR
uses: jakejarvis/s3-sync-action@be0c4ab89158cac4278689ebedd8407dd5f35a83
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/collection.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('A IIIF Collection', () => {
const URL_PARAMETERS = '#?manifest=https%3A%2F%2Ftest.iiif.library.ucla.edu%2Fcollections%2Fark%253A%252F21198%252Fz11c574k';
const URL_PARAMETERS = '#?manifest=https%3A%2F%2Fiiif.library.ucla.edu%2Fcollections%2Fark%253A%252F21198%252Fz11c574k';

it('loads Universal Viewer in an iframe', () => {
cy.visit('/' + URL_PARAMETERS)
Expand Down
26 changes: 20 additions & 6 deletions src/components/DLViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

import axios from "axios";
import { defineAsyncComponent } from "vue";
import _get from "lodash/get"

export default {
name: "DLViewer",
components: {
ImageTag: defineAsyncComponent(() => import("./ImageTag.vue")),
Mirador: defineAsyncComponent(() => import("./Mirador.vue")),
MiradorPalimpsest: defineAsyncComponent(() => import("./MiradorPalimpsest.vue")),
VideoJS: defineAsyncComponent(() => import("./VideoJS.vue")),
Expand Down Expand Up @@ -49,14 +51,19 @@ export default {
firstItemTypeFromChoice() {
return this.isChoice && this.iiif_manifest.items[0].items[0].items[0].body.items[0].type
},
getIiifService() {
const iiifServicePath = this.isV3Manifest ?
"iiif_manifest.items[0].items[0].items[0].body.service" :
"iiif_manifest.sequences[0].canvases[0].images[0].resource.service"
console.log(_get(this, iiifServicePath), !!_get(this, iiifServicePath))
return !!_get(this, iiifServicePath)
},
isChoice() {
return (this.firstItemType == "Choice")
},
isCollection() {
return (
this.iiif_manifest &&
this.iiif_manifest.type &&
this.iiif_manifest.type == "Collection")
// Have seen "'@type': 'sc:Collection'" and "'type': 'Collection'"
return _get(this, "iiif_manifest.@type", _get(this, "iiif_manifest.type", "")).includes("Collection")
},
isImage() {
return (this.firstItemType == "Image")
Expand Down Expand Up @@ -95,6 +102,13 @@ export default {
{ src: source.id, type: source.format} // HLS for Safari
)),
}
} else if (this.viewer == "ImageTag") {
return {
src: _get(this, "iiif_manifest.items[0].items[0].items[0].body.id"),
height: _get(this, "iiif_manifest.items[0].items[0].items[0].body.height"),
width: _get(this, "iiif_manifest.items[0].items[0].items[0].body.width"),
alt: _get(this, "iiif_manifest.label.none[0]", ""),
}
} else {
return {
iiif_manifest: this.iiif_manifest,
Expand All @@ -104,7 +118,6 @@ export default {
}
},
isAppleOrIOS(){
console.log("user agent info", navigator.userAgent)
return /(Apple|iOS)/.test(navigator.userAgent)
},
videoSources() {
Expand All @@ -123,7 +136,8 @@ export default {
this.isCollection ? "UniversalViewer" :
this.isVideo ? "VideoJS" :
this.isSound ? "UniversalViewer3" :
this.isImage ? "UniversalViewer" :
this.isImage && this.hasIiifService ? "UniversalViewer" :
this.isImage && !this.hasIiifService ? "ImageTag" :
"UniversalViewer"
)
},
Expand Down
25 changes: 25 additions & 0 deletions src/components/ImageTag.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<img v-bind="options" class="image-tag" />
</template>

<script>
export default {
name: "ImageTag",
props: {
options: {
// { src: [...] }
type: Object,
required: true,
},
},
};
</script>

<style>
.image-tag {
width: 100%;
height: 100%;

object-fit: contain;
}
</style>
Loading