From 029cd820529505ac3f350bd295fa1931a4d0ca68 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Mon, 7 Aug 2023 14:38:24 -0300 Subject: [PATCH 1/2] 959-use-image-dimensions Use image dimension properties if they exist when generating IIIF manifests. 959-use-image-dimensions Address PHPCS error. 959-use-image-dimensions Address PHPCS error. --- .../islandora_iiif/src/Plugin/views/style/IIIFManifest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php index 9d31d760d..2d48547c8 100644 --- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php +++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php @@ -313,6 +313,12 @@ protected function getTileSourceFromRow(ResultRow $row, $iiif_address, $iiif_bas * The width and height of the image. */ protected function getCanvasDimensions(string $iiif_url, FieldItemInterface $image, string $mime_type) { + + if (isset($image->width) + && isset($image->height)) { + return [$image->width, $image->height]; + } + try { $info_json = $this->httpClient->get($iiif_url)->getBody(); $resource = json_decode($info_json, TRUE); From 6240484bcb4f63a36133b8d86bd9996e0c75ec41 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Wed, 16 Aug 2023 00:56:45 -0300 Subject: [PATCH 2/2] 959-use-image-dimensions Make image dimension values numeric per the spec. --- .../islandora_iiif/src/Plugin/views/style/IIIFManifest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php index 2d48547c8..5a2fb63b3 100644 --- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php +++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php @@ -314,9 +314,9 @@ protected function getTileSourceFromRow(ResultRow $row, $iiif_address, $iiif_bas */ protected function getCanvasDimensions(string $iiif_url, FieldItemInterface $image, string $mime_type) { - if (isset($image->width) - && isset($image->height)) { - return [$image->width, $image->height]; + if (isset($image->width) && is_numeric($image->width) + && isset($image->height) && is_numeric($image->height)) { + return [intval($image->width), intval($image->height)]; } try {