Compare commits

..

No commits in common. 'IIIFManifest_speedup' and '2.x' have entirely different histories.

  1. 16
      modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php

16
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, $entity, $mime_type); [$width, $height] = $this->getCanvasDimensions($iiif_url, $image, $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,14 +365,12 @@ 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, $image, string $mime_type) { protected function getCanvasDimensions(string $iiif_url, FieldItemInterface $image, string $mime_type) {
$height = $image->get('field_height')->value; if (isset($image->width) && is_numeric($image->width)
$width = $image->get('field_width')->value; && isset($image->height) && is_numeric($image->height)) {
if (isset($width) && is_numeric($width) return [intval($image->width), intval($image->height)];
&& isset($height) && is_numeric($height)) { }
return [intval($width), intval($height)];
}
try { try {
$info_json = $this->httpClient->get($iiif_url)->getBody(); $info_json = $this->httpClient->get($iiif_url)->getBody();

Loading…
Cancel
Save