Skip to content

Commit

Permalink
Added an option to fix the tiled tiff media type (#4).
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-KM committed Feb 10, 2019
1 parent f5fb685 commit be96450
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
'iiifserver_manifest_logo_default' => '',
'iiifserver_manifest_force_url_from' => '',
'iiifserver_manifest_force_url_to' => '',
'iiifserver_manifest_force_tile_jpeg' => false,
'iiifserver_image_creator' => 'Auto',
'iiifserver_image_max_size' => 10000000,
'iiifserver_image_tile_dir' => 'tile',
Expand Down
12 changes: 12 additions & 0 deletions src/Form/ConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,18 @@ public function init()
],
]);

$manifestFieldset->add([
'name' => 'iiifserver_manifest_force_tile_jpeg',
'type' => Element\Text::class,
'options' => [
'label' => 'Force jpeg for tiled tiff and jpeg2000', // @translate
'info' => 'In some cases, an issue can occur with tiled tiff and metadata of the media should be updated to "image/jpeg".', // @translate
],
'attributes' => [
'id' => 'iiifserver-manifest-force-tiled-jpeg',
],
]);

$this->add([
'name' => 'iiifserver_image',
'type' => Fieldset::class,
Expand Down
4 changes: 3 additions & 1 deletion src/View/Helper/IiifManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,11 @@ protected function _iiifImage(MediaRepresentation $media, $index, $canvasUrl, $w
);
$imageUrl = $this->view->iiifForceBaseUrlIfRequired($imageUrl);

$forceTileJpeg = $this->view->setting('iiifserver_manifest_force_tile_jpeg');

$imageResource['@id'] = $imageUrl;
$imageResource['@type'] = 'dctypes:Image';
$imageResource['format'] = $media->mediaType();
$imageResource['format'] = $forceTileJpeg ? 'image/jpeg' : $media->mediaType();
$imageResource['width'] = $width;
$imageResource['height'] = $height;

Expand Down

0 comments on commit be96450

Please sign in to comment.