Browse Source

speed up iiif manifest generation

IIIFManifest_speedup
ppound 7 months ago
parent
commit
3471fd3a4b
  1. 12
      modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php

12
modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php

@ -296,7 +296,7 @@ class IIIFManifest extends StylePluginBase {
$canvas_id = $iiif_base_id . '/canvas/' . $entity->id(); $canvas_id = $iiif_base_id . '/canvas/' . $entity->id();
$annotation_id = $iiif_base_id . '/annotation/' . $entity->id(); $annotation_id = $iiif_base_id . '/annotation/' . $entity->id();
[$width, $height] = $this->getCanvasDimensions($iiif_url, $image, $mime_type); [$width, $height] = $this->getCanvasDimensions($iiif_url, $entity, $mime_type);
$tmp_canvas = [ $tmp_canvas = [
// @see https://iiif.io/api/presentation/2.1/#canvas // @see https://iiif.io/api/presentation/2.1/#canvas
@ -365,11 +365,13 @@ class IIIFManifest extends StylePluginBase {
* @return [string] * @return [string]
* The width and height of the image. * The width and height of the image.
*/ */
protected function getCanvasDimensions(string $iiif_url, FieldItemInterface $image, string $mime_type) { protected function getCanvasDimensions(string $iiif_url, $image, string $mime_type) {
if (isset($image->width) && is_numeric($image->width) $height = $image->get('field_height')->value;
&& isset($image->height) && is_numeric($image->height)) { $width = $image->get('field_width')->value;
return [intval($image->width), intval($image->height)]; if (isset($width) && is_numeric($width)
&& isset($height) && is_numeric($height)) {
return [intval($width), intval($height)];
} }
try { try {

Loading…
Cancel
Save