Skip to content

Conversation

@ronja-koistinen
Copy link

@ronja-koistinen ronja-koistinen commented Dec 12, 2025

Add a IIIFManifest action in RecordController. It generates a IIIF Presentation API v3 manifest for internal use. This is not intended to be exposed in the Finna API or as a user-discoverable resource.

  • Pixel size is unavailable in metadata, so it is omitted, even though the Presentation API spec requires it.
  • Because images are served over Cover/Show, they are all already image/jpeg, so we hard-code the MIME type
  • Configurable CORS headers

See https://iiif.io/api/presentation/3.0/

Add a IIIFManifest action in RecordController. It generates a IIIF Presentation
API v3 manifest for internal use. This is not intended to be exposed in the
Finna API or as a user-discoverable resource.

* Pixel size is unavailable in metadata, so it is omitted, even though the Presentation API spec requires it.
* Because images are served over Cover/Show, they are all already image/jpeg, so we hard-code the MIME type
* Configurable CORS headers with '*' default

See https://iiif.io/api/presentation/3.0/
@ronja-koistinen
Copy link
Author

ronja-koistinen commented Dec 12, 2025

Entä pitäisikö olla requiredStatement, jossa mainittaisiin jotain että "Tämä manifesti on Finnan automaattisesti luoma, eikä se välttämättä sovellu monipuoliseen IIIF-jatkokäyttöön"? https://iiif.io/api/presentation/3.0/#requiredstatement

@ronja-koistinen
Copy link
Author

ronja-koistinen commented Dec 19, 2025

Mitäs me tehdään sen redirectin kanssa, jota ehdotin Slackissä? Luonnostelin jotain tällaista:

    protected function iiifManifestAction()
    {
        $response = $this->getResponse();
        $headers = $response->getHeaders();
        $driver = $this->loadRecord();

        if($datasourceManifests = $driver->tryMethod('getIiifManifests')) {
            $headers->addHeaderLine('Location', $datasourceManifests[0]['url']);
            $response->setStatusCode(301);
            return $response;
        }
    /* jne. */

edit: Varmaan 302 parempi itse asiassa.

@EreMaijala
Copy link

Mitäs me tehdään sen redirectin kanssa, jota ehdotin Slackissä? Luonnostelin jotain tällaista:

    protected function iiifManifestAction()
    {
        $response = $this->getResponse();
        $headers = $response->getHeaders();
        $driver = $this->loadRecord();

        if($datasourceManifests = $driver->tryMethod('getIiifManifests')) {
            $headers->addHeaderLine('Location', $datasourceManifests[0]['url']);
            $response->setStatusCode(301);
            return $response;
        }
    /* jne. */

edit: Varmaan 302 parempi itse asiassa.

Joo, 302 on parempi. Ja toteutus on ok.

This is in anticipation of later unit testing. Now createManifest() does not
require a RecordDriver as input, so it will require no complicated mocking to
unit test.
@EreMaijala EreMaijala merged commit 7b7413b into NatLibFi:dev Jan 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants