Skip to content

Commit

Permalink
changed mimetype in iiif manifest and added libvips-tools to install
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardKoschicek committed Nov 13, 2023
1 parent cb2cfc6 commit 56c911e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion install.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ high-quality, attributed digital objects online at scale. Be aware that:

### Installation

sudo apt install iipimage-server libvips
sudo apt install iipimage-server libvips-tools
sudo service apache2 restart

You can test http://your.server/iipsrv/iipsrv.fcgi to see if it runs.
Expand Down
7 changes: 5 additions & 2 deletions openatlas/api/endpoints/iiif.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import mimetypes
from typing import Any

import requests
Expand Down Expand Up @@ -42,6 +43,7 @@ def get(id_: int) -> Response:
@staticmethod
def build_canvas(metadata: dict[str, Any]) -> dict[str, Any]:
entity = metadata['entity']
mime_type, _ = mimetypes.guess_type(g.files[entity.id])
return {
"@id": url_for(
'api.iiif_canvas', id_=entity.id, version=2, _external=True),
Expand All @@ -57,7 +59,7 @@ def build_canvas(metadata: dict[str, Any]) -> dict[str, Any]:
"thumbnail": {
"@id": f'{metadata["img_url"]}/full/!200,200/0/default.jpg',
"@type": "dctypes:Image",
"format": "image/jpeg",
"format": mime_type,
"height": 200,
"width": 200,
"service": {
Expand All @@ -75,6 +77,7 @@ def get(id_: int) -> Response:
@staticmethod
def build_image(metadata: dict[str, Any]) -> dict[str, Any]:
id_ = metadata['entity'].id
mime_type, _ = mimetypes.guess_type(g.files[id_])
return {
"@context": "https://iiif.io/api/presentation/2/context.json",
"@id":
Expand All @@ -84,7 +87,7 @@ def build_image(metadata: dict[str, Any]) -> dict[str, Any]:
"resource": {
"@id": metadata['img_url'],
"@type": "dctypes:Image",
"format": "image/jpeg",
"format": mime_type,
"service": {
"@context": "https://iiif.io/api/image/2/context.json",
"@id": metadata['img_url'],
Expand Down

0 comments on commit 56c911e

Please sign in to comment.