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

use native file extension for image view

parent e6e76d09
Pipeline #21863 passed with stages
in 6 minutes and 5 seconds
...@@ -26,9 +26,7 @@ import de.digitalcollections.iiif.model.sharedcanvas.{ ...@@ -26,9 +26,7 @@ import de.digitalcollections.iiif.model.sharedcanvas.{
Sequence => IIIFSequence Sequence => IIIFSequence
} }
import de.digitalcollections.iiif.model.{ import de.digitalcollections.iiif.model.{
MetadataEntry,
OtherContent, OtherContent,
PropertyValue,
ImageContent => IIIFImageContent ImageContent => IIIFImageContent
} }
import ujson.{Arr => JArr, Obj => JObj} import ujson.{Arr => JArr, Obj => JObj}
...@@ -80,20 +78,19 @@ class Manifest { ...@@ -80,20 +78,19 @@ class Manifest {
val imageContent = new IIIFImageContent( val imageContent = new IIIFImageContent(
Extractors Extractors
.digitalObjectId(digitalObject) .digitalObjectId(digitalObject)
.flatMap(id => Some(s"$id/iiif/full/full/0/default.jpg")) .flatMap(id => {
val extension = Extractors
.mimeType(digitalObject)
.flatMap {
case "image/png" => Some("png")
case "image/jpg" => Some("jpg")
case _ => None
}
.getOrElse("jpg")
Some(s"$id/iiif/full/full/0/default.$extension")
})
.getOrElse("") .getOrElse("")
) )
Extractors
.componentColor(digitalObject)
.foreach(v =>
imageContent
.addMetadata(
new MetadataEntry(
new PropertyValue("componentColor"),
new PropertyValue(v.head, v.tail: _*)
)
)
)
Extractors Extractors
.license(graph)(digitalObject.value) .license(graph)(digitalObject.value)
.foreach(v => imageContent.addLicense(v)) .foreach(v => imageContent.addLicense(v))
...@@ -314,7 +311,7 @@ class Manifest { ...@@ -314,7 +311,7 @@ class Manifest {
private def replaceDomainNamesWithPlaceholders(jsonObj: String): String = { private def replaceDomainNamesWithPlaceholders(jsonObj: String): String = {
jsonObj jsonObj
.replaceAll( .replaceAll(
""""https://memobase.ch/digital/([^/"]+/iiif/[^/"]/[^/"]/0/default.jpg)""", """"https://memobase.ch/digital/([^/"]+/iiif/[^/"]+/[^/"]+/0/default..{3})""",
""""{{.IIIFImage}}/$1""" """"{{.IIIFImage}}/$1"""
) )
.replaceAll( .replaceAll(
......
{"@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":"{{.IIIFManifest}}/BAZ-B_MEI-MEI_67484-1/iiif/full/!150,/0/default.jpg","format":"image/jpeg"},"images":[{"@type":"oa:Annotation","motivation":"sc:painting","resource":{"@id":"{{.IIIFManifest}}/BAZ-B_MEI-MEI_67484-1/iiif/full/full/0/default.jpg","@type":"dctypes:Image","metadata":[{"label":"componentColor","value":["A9A9A9","2F2F4F","000000","527F76","A8A8A8","545454","E6E6FA","C0D9D9"]}],"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":"{{.IIIFManifest}}/BAZ-B_MEI-MEI_67484-1/iiif/full/!150,/0/default.jpg","format":"image/jpeg"},"viewingHint":"individuals"} {"@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 \ 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":"{{.IIIFManifest}}/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":"{{.IIIFManifest}}/aag-001-RBA1-4-42733_1-1/iiif/full/full/0/default.jpg","@type":"dctypes:Image","metadata":[{"label":"componentColor","value":["A8A8A8","2F2F4F","000000","C0C0C0","527F76","545454","E6E6FA","A9A9A9"]}],"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":"{{.IIIFManifest}}/aag-001-RBA1-4-42733_1-1/iiif/full/!150,/0/default.jpg","format":"image/jpeg"},"viewingHint":"individuals"} {"@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 \ 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