|
|
|
@ -296,7 +296,7 @@ class IIIFManifest extends StylePluginBase {
|
|
|
|
|
$canvas_id = $iiif_base_id . '/canvas/' . $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 = [ |
|
|
|
|
// @see https://iiif.io/api/presentation/2.1/#canvas |
|
|
|
@ -365,11 +365,13 @@ class IIIFManifest extends StylePluginBase {
|
|
|
|
|
* @return [string] |
|
|
|
|
* 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) |
|
|
|
|
&& isset($image->height) && is_numeric($image->height)) { |
|
|
|
|
return [intval($image->width), intval($image->height)]; |
|
|
|
|
$height = $image->get('field_height')->value; |
|
|
|
|
$width = $image->get('field_width')->value; |
|
|
|
|
if (isset($width) && is_numeric($width) |
|
|
|
|
&& isset($height) && is_numeric($height)) { |
|
|
|
|
return [intval($width), intval($height)]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|