Unverified Commit cc512d16 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

provide more information on thumbnail

parent 893fc4dc
Pipeline #21867 passed with stages
in 6 minutes
......@@ -26,6 +26,7 @@ import de.digitalcollections.iiif.model.sharedcanvas.{
Sequence => IIIFSequence
}
import de.digitalcollections.iiif.model.{
MimeType,
OtherContent,
ImageContent => IIIFImageContent
}
......@@ -116,11 +117,21 @@ class Manifest {
Extractors
.imageWidth(digitalObject)
.foreach(v => canvas.setWidth(v.round.toInt))
createThumbnail(digitalObject).foreach(canvas.addThumbnail(_))
canvas
}
private def createThumbnail(digitalObject: JObj): Option[IIIFImageContent] = {
Extractors
.digitalObjectId(digitalObject)
.flatMap(id => Some(s"$id/iiif/full/!150,/0/default.jpg"))
.foreach(v => canvas.addThumbnail(new IIIFImageContent(v)))
canvas
.flatMap(id => Some(s"$id/iiif/full/!120,120/0/default.jpg"))
.flatMap(uri => {
val imageContent = new IIIFImageContent(uri)
imageContent.setFormat(MimeType.MIME_IMAGE_JPEG)
imageContent.setWidth(120)
imageContent.setHeight(120)
Some(imageContent)
})
}
private def createSequence(digitalObject: JObj): IIIFSequence = {
......@@ -142,10 +153,7 @@ class Manifest {
Extractors.manifestId(digitalObject).getOrElse("")
)
val extractionResult = ExtractionResult(manifest)
Extractors
.digitalObjectId(digitalObject)
.flatMap(id => Some(s"$id/iiif/full/!150,/0/default.jpg"))
.foreach(v => manifest.addThumbnail(new IIIFImageContent(v)))
createThumbnail(digitalObject).foreach(manifest.addThumbnail(_))
Extractors
.title(record)
.foreach(v => manifest.addLabel(v))
......@@ -326,6 +334,10 @@ class Manifest {
""""https://memobase.ch/([^/"]+)""",
""""{{.IIIFRendering}}/$1"""
)
.replaceAll(
"(\\\\r|\\\\n|\\\\r\\\\n)",
raw"\\\\n"
)
}
}
......
{"@context":"http://iiif.io/api/presentation/2/context.json","@type":"sc:Manifest","@id":"{{.IIIFManifest}}/BAZ-B_MEI-MEI_67484-1/manifest/v2","label":"Büroraum der Firma «Corn Products Co. Ltd»","metadata":[{"label":"placeOfCapture","value":"Zürich, Kornhausbrücke 7"},{"label":"spatial","value":"Zürich"}],"description":"Büroraum mit Arbeitsplätzen, Stehpult, div. Bürotechnische Apparate","navDate":"1933-05-05T00:00:00Z","attribution":"BAZ\n\nnach Absprache","rendering":{"@id":"{{.IIIFRendering}}/BAZ-B_MEI-MEI_67484","label":"website","format":"text/html"},"sequences":[{"@id":"{{.IIIFManifest}}/BAZ-B_MEI-MEI_67484-1/sequence/default","@type":"sc:Sequence","label":"default","canvases":[{"@id":"{{.IIIFManifest}}/BAZ-B_MEI-MEI_67484-1/canvas/default","@type":"sc:Canvas","label":"digitalObject","thumbnail":{"@id":"{{.IIIFImage}}/BAZ-B_MEI-MEI_67484-1/iiif/full/!150,/0/default.jpg","format":"image/jpeg"},"images":[{"@type":"oa:Annotation","motivation":"sc:painting","resource":{"@id":"{{.IIIFImage}}/BAZ-B_MEI-MEI_67484-1/iiif/full/full/0/default.jpg","@type":"dctypes:Image","format":"image/jpeg","width":640,"height":484},"on":"{{.IIIFManifest}}/BAZ-B_MEI-MEI_67484-1/canvas/default"}],"width":640,"height":484}],"viewingHint":"individuals"}],"thumbnail":{"@id":"{{.IIIFImage}}/BAZ-B_MEI-MEI_67484-1/iiif/full/!150,/0/default.jpg","format":"image/jpeg"},"viewingHint":"individuals"}
\ No newline at end of file
{"@context":"http://iiif.io/api/presentation/2/context.json","@type":"sc:Manifest","@id":"{{.IIIFManifest}}/BAZ-B_MEI-MEI_67484-1/manifest/v2","label":"Büroraum der Firma «Corn Products Co. Ltd»","metadata":[{"label":"placeOfCapture","value":"Zürich, Kornhausbrücke 7"},{"label":"spatial","value":"Zürich"}],"description":"Büroraum mit Arbeitsplätzen, Stehpult, div. Bürotechnische Apparate","navDate":"1933-05-05T00:00:00Z","attribution":"BAZ\\n\\nnach Absprache","rendering":{"@id":"{{.IIIFRendering}}/BAZ-B_MEI-MEI_67484","label":"website","format":"text/html"},"sequences":[{"@id":"{{.IIIFManifest}}/BAZ-B_MEI-MEI_67484-1/sequence/default","@type":"sc:Sequence","label":"default","canvases":[{"@id":"{{.IIIFManifest}}/BAZ-B_MEI-MEI_67484-1/canvas/default","@type":"sc:Canvas","label":"digitalObject","thumbnail":{"@id":"{{.IIIFImage}}/BAZ-B_MEI-MEI_67484-1/iiif/full/!120,120/0/default.jpg","format":"image/jpeg","width":120,"height":120},"images":[{"@type":"oa:Annotation","motivation":"sc:painting","resource":{"@id":"{{.IIIFImage}}/BAZ-B_MEI-MEI_67484-1/iiif/full/full/0/default.jpg","@type":"dctypes:Image","format":"image/jpeg","width":640,"height":484},"on":"{{.IIIFManifest}}/BAZ-B_MEI-MEI_67484-1/canvas/default"}],"width":640,"height":484}],"viewingHint":"individuals"}],"thumbnail":{"@id":"{{.IIIFImage}}/BAZ-B_MEI-MEI_67484-1/iiif/full/!120,120/0/default.jpg","format":"image/jpeg","width":120,"height":120},"viewingHint":"individuals"}
\ No newline at end of file
{"@context":"http://iiif.io/api/presentation/2/context.json","@type":"sc:Manifest","@id":"{{.IIIFManifest}}/aag-001-RBA1-4-42733_1-1/manifest/v2","label":"Fünfkämpfer Alex Tschui mit René Ziegler","metadata":[{"label":"scopeAndContent","value":"Quelle: RiBiDi"},{"label":"Author","value":"Siegfried Kuhn"}],"navDate":"1968-09-28T00:00:00Z","attribution":"StAAG/RBA\n\nNutzung auf Anfrage. Kein Herunterladen. Über die Nutzungsgebühren werden Sie durch den Rechteinhaber informiert.","rendering":{"@id":"{{.IIIFRendering}}/aag-001-RBA1-4-42733_1","label":"website","format":"text/html"},"sequences":[{"@id":"{{.IIIFManifest}}/aag-001-RBA1-4-42733_1-1/sequence/default","@type":"sc:Sequence","label":"default","canvases":[{"@id":"{{.IIIFManifest}}/aag-001-RBA1-4-42733_1-1/canvas/default","@type":"sc:Canvas","label":"digitalObject","thumbnail":{"@id":"{{.IIIFImage}}/aag-001-RBA1-4-42733_1-1/iiif/full/!150,/0/default.jpg","format":"image/jpeg"},"images":[{"@type":"oa:Annotation","motivation":"sc:painting","resource":{"@id":"{{.IIIFImage}}/aag-001-RBA1-4-42733_1-1/iiif/full/full/0/default.png","@type":"dctypes:Image","format":"image/png","width":1600,"height":1072},"on":"{{.IIIFManifest}}/aag-001-RBA1-4-42733_1-1/canvas/default"}],"width":1600,"height":1072}],"viewingHint":"individuals"}],"thumbnail":{"@id":"{{.IIIFImage}}/aag-001-RBA1-4-42733_1-1/iiif/full/!150,/0/default.jpg","format":"image/jpeg"},"viewingHint":"individuals"}
\ No newline at end of file
{"@context":"http://iiif.io/api/presentation/2/context.json","@type":"sc:Manifest","@id":"{{.IIIFManifest}}/aag-001-RBA1-4-42733_1-1/manifest/v2","label":"Fünfkämpfer Alex Tschui mit René Ziegler","metadata":[{"label":"scopeAndContent","value":"Quelle: RiBiDi"},{"label":"Author","value":"Siegfried Kuhn"}],"navDate":"1968-09-28T00:00:00Z","attribution":"StAAG/RBA\\n\\nNutzung auf Anfrage. Kein Herunterladen. Über die Nutzungsgebühren werden Sie durch den Rechteinhaber informiert.","rendering":{"@id":"{{.IIIFRendering}}/aag-001-RBA1-4-42733_1","label":"website","format":"text/html"},"sequences":[{"@id":"{{.IIIFManifest}}/aag-001-RBA1-4-42733_1-1/sequence/default","@type":"sc:Sequence","label":"default","canvases":[{"@id":"{{.IIIFManifest}}/aag-001-RBA1-4-42733_1-1/canvas/default","@type":"sc:Canvas","label":"digitalObject","thumbnail":{"@id":"{{.IIIFImage}}/aag-001-RBA1-4-42733_1-1/iiif/full/!120,120/0/default.jpg","format":"image/jpeg","width":120,"height":120},"images":[{"@type":"oa:Annotation","motivation":"sc:painting","resource":{"@id":"{{.IIIFImage}}/aag-001-RBA1-4-42733_1-1/iiif/full/full/0/default.png","@type":"dctypes:Image","format":"image/png","width":1600,"height":1072},"on":"{{.IIIFManifest}}/aag-001-RBA1-4-42733_1-1/canvas/default"}],"width":1600,"height":1072}],"viewingHint":"individuals"}],"thumbnail":{"@id":"{{.IIIFImage}}/aag-001-RBA1-4-42733_1-1/iiif/full/!120,120/0/default.jpg","format":"image/jpeg","width":120,"height":120},"viewingHint":"individuals"}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment