From e11ec6c28a262087bcc0bef8e40b12227841d1e7 Mon Sep 17 00:00:00 2001 From: Camden Mecklem Date: Wed, 13 Nov 2024 16:46:42 -0500 Subject: [PATCH] remove thumbnail generation and configuration --- README.md | 2 -- data/config.json.example | 2 -- src/index.js | 3 --- src/render.js | 16 +++++----------- src/store.js | 4 ++-- 5 files changed, 7 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 83fccba..5009013 100644 --- a/README.md +++ b/README.md @@ -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 } ``` diff --git a/data/config.json.example b/data/config.json.example index 7037dfa..a3e444e 100644 --- a/data/config.json.example +++ b/data/config.json.example @@ -6,6 +6,4 @@ "inputPath": "", "outputPath": "", "baseUrl": "http://localhost:8080", - "thumbnailWidth": 124, - "thumbnailHeight": 192 } diff --git a/src/index.js b/src/index.js index 6acf963..b5f4e98 100755 --- a/src/index.js +++ b/src/index.js @@ -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 = '.' } diff --git a/src/render.js b/src/render.js index 5d6d746..e7016f3 100644 --- a/src/render.js +++ b/src/render.js @@ -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 @@ -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 @@ -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] } @@ -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) @@ -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') @@ -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, diff --git a/src/store.js b/src/store.js index c0aff61..885e541 100644 --- a/src/store.js +++ b/src/store.js @@ -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