|
|
@ -12,6 +12,7 @@ use Drupal\Core\Config\ImmutableConfig; |
|
|
|
use Drupal\Core\File\FileSystem; |
|
|
|
use Drupal\Core\File\FileSystem; |
|
|
|
use GuzzleHttp\Client; |
|
|
|
use GuzzleHttp\Client; |
|
|
|
use GuzzleHttp\Exception\ClientException; |
|
|
|
use GuzzleHttp\Exception\ClientException; |
|
|
|
|
|
|
|
use GuzzleHttp\Exception\ConnectException; |
|
|
|
use GuzzleHttp\Exception\ServerException; |
|
|
|
use GuzzleHttp\Exception\ServerException; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -183,6 +184,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(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dsm("BEFORE REQUEST"); |
|
|
|
// Try to fetch the IIIF metadata for the image. |
|
|
|
// Try to fetch the IIIF metadata for the image. |
|
|
|
try { |
|
|
|
try { |
|
|
|
$info_json = $this->httpClient->get($iiif_url)->getBody(); |
|
|
|
$info_json = $this->httpClient->get($iiif_url)->getBody(); |
|
|
@ -190,11 +192,7 @@ class IIIFManifest extends StylePluginBase { |
|
|
|
$width = $resource['width']; |
|
|
|
$width = $resource['width']; |
|
|
|
$height = $resource['height']; |
|
|
|
$height = $resource['height']; |
|
|
|
} |
|
|
|
} |
|
|
|
catch (ClientException $e) { |
|
|
|
catch (ClientException | ServerException | ConnectException $e) { |
|
|
|
} |
|
|
|
|
|
|
|
catch (ServerException $e) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If we couldn't get the info.json from IIIF |
|
|
|
// If we couldn't get the info.json from IIIF |
|
|
|
// try seeing if we can get it from Drupal. |
|
|
|
// try seeing if we can get it from Drupal. |
|
|
|
if (empty($width) || empty($height)) { |
|
|
|
if (empty($width) || empty($height)) { |
|
|
@ -215,6 +213,7 @@ class IIIFManifest extends StylePluginBase { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$canvases[] = [ |
|
|
|
$canvases[] = [ |
|
|
|
// @see https://iiif.io/api/presentation/2.1/#canvas |
|
|
|
// @see https://iiif.io/api/presentation/2.1/#canvas |
|
|
|