Skip to content

Support IIIF 3 images in CreateIIIFURL

https://redmine.teklia.com/issues/10642

Requires #1971 (closed)

  • arkindex.images.iiif.ImageInformation must be updated so that version is a Literal[2, 3] to allow both version numbers.

  • arkindex.images.iiif._parse_image_information must be updated to support both IIIF 2 and 3. We will go with the most flexible detection method.

    • After the response is verified to be a dict, the method must test whether @id and id exist on the dict.

      • When neither are defined, the existing Missing required properties can be raised.
      • When both are defined, another error should be raised because the ID is duplicated.
      • When @id is defined, the parsing should continue for IIIF 2.
      • When id is defined, the parsing should continue for IIIF 3.
    • The width and height are parsed as they are now.

    • In IIIF 3 only, the profile should not be required, as we do not use it anymore.

    • In IIIF 2 only, maxWidth and maxHeight should be first parsed in profile[].maxWidth and profile[].maxHeight as they are now. When they were not found, they should be parsed like IIIF 3, as some servers were using a non-standard location that happened to be the correct one for IIIF 3.

    • In IIIF 3 and in the aforementioned IIIF 2 edge case, maxWidth and maxHeight should be found in the root dict, but they are optional.

    • The method should now return an ImageInformation with the correct version, and with the URL coming from either @id or id.

  • ImageServer.check_options must be updated to support version 3. Instead of failing when the version is not 2, it should check that its version matches the version sent to the function.

  • ImageServer.objects.create_from_image_information must only use the /iiif/2/ prefix with IIIF 2, and must now also support /iiif/3/ with IIIF 3.

  • Unit tests should be added to:

    • get_image_information to verify all the updated parsing;
    • CreateIIIFURL to verify that we can create IIIF 3 images, and that an unexpected version on an existing server causes an error;
    • Image.perform_check to verify that we can check IIIF 3 images, and that an unexpected version causes an error;
    • ImageServer.objects.create_from_image_information to verify that the version is set correctly and that the version-specific prefixes are handled with the correct versions.
Edited by Erwan Rouchet