Skip to content

Commit

Permalink
added Logo to manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardKoschicek committed Oct 9, 2023
1 parent 83f5938 commit 75f0052
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/iiif.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
'compression': 'deflate' # 'deflate' or 'jpeg'
}

IIIF_IMAGE_EXT = ALLOWED_IMAGE_EXT + ['.pdf']
IIIF_IMAGE_EXT = ALLOWED_IMAGE_EXT + ['.pdf']
17 changes: 16 additions & 1 deletion openatlas/api/endpoints/iiif.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any

import requests
from flask import jsonify, Response, url_for
from flask import jsonify, Response, url_for, g, request
from flask_restful import Resource

from openatlas import app
Expand Down Expand Up @@ -124,6 +124,7 @@ def get_manifest_version_2(id_: int) -> dict[str, Any]:
"@language": "en"}],
"license": get_license_name(entity),
"attribution": "By OpenAtlas",
"logo": get_logo(),
"sequences": [
IIIFSequence.build_sequence(get_metadata(entity))],
"structures": []}
Expand All @@ -136,3 +137,17 @@ def get_metadata(entity: Entity) -> dict[str, Any]:
req = requests.get(f"{image_url}/info.json")
image_api = req.json()
return {'entity': entity, 'img_url': image_url, 'img_api': image_api}


def get_logo() -> dict[str, Any]:
return {
"@id": url_for(
'api.display',
filename=g.settings['logo_file_id'],
_external=True),
"service": {
"@context": "http://iiif.io/api/image/2/context.json",
"@id": url_for('overview', _external=True),
"profile": "http://iiif.io/api/image/2/level2.json"
}
}

0 comments on commit 75f0052

Please sign in to comment.