Skip to content

Commit

Permalink
Add config schema for new Action, and alter wording.
Browse files Browse the repository at this point in the history
  • Loading branch information
rosiel committed Jul 17, 2024
1 parent 7bae08f commit 11520ff
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
25 changes: 13 additions & 12 deletions modules/islandora_iiif/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,38 +41,39 @@ This module implements a Views Style plugin. It provides the following settings:
3. Structured Text Term: If your Islandora Object has a separate media with hOCR, point to it with this setting.
4. File Width and Height fields: If you want to use TIFF or JP2 files directly, set the fields where the files' width and height can be found with these settings.

### Media Attributes from IIIF Action
### Action to add image dimensions from the IIIF server

The module also provides an action that lets a site owner populate a TIFF or JP2 image's width and
height attributes into fields so the IIIF server is not bogged down trying to generate a manifest if
height attributes into fields on the media so the IIIF server is not bogged down trying to generate a manifest if
it doesn't have them.

It is a complex action that must be configured. Go to
It is an advanced action that must be configured. Go to
Admin -> Actions UI -> Actions, choose
"Add image dimensions retrieved from the IIIF server" from the Create Action drop-down
And on the next screen, choose the width
And on the next screen, choose the Media Use term which this should be applied to (as
it is a node action), as well as the width
and height fields that the action should
populate.

To use it, either:
- Add it as a derivative reaction to a node with an Original FIle as its child, or
- Use it as a batch action, such as on a Paged Content object's list of child pages.
- Add it as a derivative reaction (in Contexts) to a node, or
- Use it as a batch action in a View, such as on a Paged Content object's list of child pages.

### Setting up the action as a Context Reaction
### Setting up the action as a Contexts Derivative Reaction

These instructions assume a standard Islandora Starter Site, so if you have different field names or Contexts, adjust accordingly.

1. Go to admin/config/system/actions
2. Choose "Add image dimensions retrieved from the IIIF server" from the Create Complex Action drop-down and then click Create.
2. Choose "Add image dimensions retrieved from the IIIF server" from the Create advanced Action drop-down and then click Create.
3. Enter Original File for the Source Media Use term.
4. Choose media -- file -- Width and Media -- File -- Height for the corresponding configuration values and click Save.
5. Go to admin/structure/context, and click Duplicate oon the Page Derivatives row.
6. Name the new context something like "Retrieve Page Dimensionss". and edit it.
5. Go to admin/structure/context, and click Duplicate on the Page Derivatives row.
6. Name the new context something like "Retrieve Page Dimensions" and edit it.
7. This is the tricky bit, delete 'Original File' from the 'Media has term with URI' field and replace it with Service File. The explanation for this is that to retrieve a file from the IIIF server, it must be part of an Islandora Media that has been fully created and saved and given a URL. This hasn't happened yet when Original File derivatives are being created, so we need to hang our action onto a derivative that is created after the original one.
8. Under Reactions, deselect the existing actions and select "Add i mage dimensions from IIIF sserver" and click Save and continue.
8. Under Reactions, deselect the existing actions and select "Add image dimensions from IIIF server" and click Save and continue.
9. Go back to your Paged Content object and add another child with a File media, to which you should upload another TIFF or JP2 file.
10. Without going to the Original File Book Manifestt, make sure that a service file has been generated, then click Edit on the Original File media.
11. Ensure that the Width and Height fields are populated with thee correct values from the file.
11. Ensure that the Width and Height fields are populated with the correct values based on the file.


## Documentation
Expand Down
10 changes: 10 additions & 0 deletions modules/islandora_iiif/config/schema/islandora_iiif.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ views.style.iiif_manifest:
search_endpoint:
type: string
label: "Search endpoint path"

action.configuration.media_attributes_from_iiif_action:
type: mapping
mapping:
source_term_uri:
type: string
width_field:
type: string
height_field:
type: string
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static function create(ContainerInterface $container, array $configuratio
public function execute($entity = NULL) {
$width = $height = FALSE;

// Get the original File media use term.
// Get the selected media use term.
$source_term = $this->utils->getTermForUri($this->configuration['source_term_uri']);

$source_mids = $this->utils->getMediaReferencingNodeAndTerm($entity, $source_term);
Expand Down Expand Up @@ -204,10 +204,10 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
$form['source_term'] = [
'#type' => 'entity_autocomplete',
'#target_type' => 'taxonomy_term',
'#title' => $this->t('Source media use term'),
'#title' => $this->t('Media use term of media to process.'),
'#default_value' => $this->utils->getTermForUri($this->configuration['source_term_uri']),
'#required' => TRUE,
'#description' => $this->t('Term indicating the source media'),
'#description' => $this->t('Term that indicates the child media on which to perform this action.'),
];

$form['width_field'] = [
Expand Down Expand Up @@ -235,7 +235,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
public function defaultConfiguration() {
$config = parent::defaultConfiguration();

$config['media_use_term'] = '';
$config['source_term_uri'] = '';
$config['width_field'] = '';
$config['height_field'] = '';

Expand Down

0 comments on commit 11520ff

Please sign in to comment.