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

Remove thumbnail generation and configuration #40

Merged
merged 1 commit into from
Nov 14, 2024
Merged
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
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ The following commands are available to the EditionCrafter CLI. Note that you ma
"inputPath": "myfile.xml",
"outputPath": ".",
"baseUrl": "http://localhost:8080",
"thumbnailWidth": 124,
"thumbnailHeight": 192
}
```

Expand Down
2 changes: 0 additions & 2 deletions data/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
"inputPath": "",
"outputPath": "",
"baseUrl": "http://localhost:8080",
"thumbnailWidth": 124,
"thumbnailHeight": 192
}
3 changes: 0 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ function processArguments() {
let options = parseOptions(args)

if (options.mode === 'process') {
options.thumbnailHeight = 192
options.thumbnailWidth = 124

if (!options.outputPath) {
options.outputPath = '.'
}
Expand Down
16 changes: 5 additions & 11 deletions src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function renderTextAnnotationPage(baseURI, canvasID, surface, apIndex) {
}

// Builds a painting annotation for the `items` array
function buildItemAnnotation(canvas, surface, thumbnailWidth, thumbnailHeight) {
function buildItemAnnotation(canvas, surface) {
const annotation = structuredClone(annotationTemplate)
const { imageURL, width, height } = surface

Expand All @@ -164,12 +164,6 @@ function buildItemAnnotation(canvas, surface, thumbnailWidth, thumbnailHeight) {
type: 'ImageService2',
profile: 'http://iiif.io/api/image/2/level2.json',
}]
annotation.body.thumbnail = [{
id: `${imageURL}/full/${thumbnailWidth},${thumbnailHeight}/0/default.jpg`,
format: 'image/jpeg',
type: 'ImageService2',
profile: 'http://iiif.io/api/image/2/level2.json',
}]
}

return annotation
Expand Down Expand Up @@ -219,7 +213,7 @@ function buildTagAnnotations(surface) {
})
}

function renderManifest(manifestLabel, baseURI, surfaces, thumbnailWidth, thumbnailHeight, glossaryURL) {
function renderManifest(manifestLabel, baseURI, surfaces, glossaryURL) {
const manifest = structuredClone(manifestTemplate)
manifest.id = `${baseURI}/iiif/manifest.json`
manifest.label = { en: [manifestLabel] }
Expand All @@ -234,7 +228,7 @@ function renderManifest(manifestLabel, baseURI, surfaces, thumbnailWidth, thumbn
canvas.label = { none: [label] }
canvas.items[0].id = `${canvas.id}/annotationpage/0`

const itemAnnotation = buildItemAnnotation(canvas, surface, thumbnailWidth, thumbnailHeight)
const itemAnnotation = buildItemAnnotation(canvas, surface)

canvas.items[0].items.push(itemAnnotation)

Expand Down Expand Up @@ -343,7 +337,7 @@ function renderResources(doc, htmlDoc) {
}

function renderTEIDocument(xml, options) {
const { baseUrl, teiDocumentID, thumbnailWidth, thumbnailHeight } = options
const { baseUrl, teiDocumentID } = options
const doc = new JSDOM(xml, { contentType: 'text/xml' }).window.document
const status = validateTEIDoc(doc)
if (status !== 'ok')
Expand All @@ -363,7 +357,7 @@ function renderTEIDocument(xml, options) {
const documentURL = `${baseUrl}${baseUrl !== '/' ? '/' : ''}${teiDocumentID}`
// TODO temporary hardcode
const glossaryURL = 'https://cu-mkp.github.io/editioncrafter-data/fr640_3r-3v-example/glossary.json'
const manifest = renderManifest(teiDocumentID, documentURL, surfaces, thumbnailWidth, thumbnailHeight, glossaryURL)
const manifest = renderManifest(teiDocumentID, documentURL, surfaces, glossaryURL)

return {
id: teiDocumentID,
Expand Down
4 changes: 2 additions & 2 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ async function loadTEIDocument(teiDocumentID, documentStore) {
const { archivEngineURL, authToken, projectID } = documentStore
const { resourceID } = teiDocument
const { resourceEntries } = await getResources(archivEngineURL, authToken, projectID, resourceID)
const { baseUrl, thumbnailWidth, thumbnailHeight } = documentStore
const renderOptions = { teiDocumentID, baseUrl, thumbnailWidth, thumbnailHeight }
const { baseUrl } = documentStore
const renderOptions = { teiDocumentID, baseUrl }
teiDocument = processResources(resourceEntries, resourceID, renderOptions)
teiDocuments[teiDocumentID] = teiDocument
return teiDocument
Expand Down