Skip to content

Latest commit

 

History

History
84 lines (54 loc) · 2.48 KB

File metadata and controls

84 lines (54 loc) · 2.48 KB

create-metadata

The create-metadata script can probe one or more image files and set the appropriate width, height, pages, and tile size metadata. It can be invoked three different ways

Standalone Script Invocation

Prerequisites

Step 1

Make sure the AWS CLI is properly configured with credentials that have read/write access to the S3 bucket containing the images that will be served by serverless-iiif

Step 2

Clone this repository.

Step 3

Install runtime dependencies:

npm ci

Step 4

Run the script:

export sourceBucket="my-image-bucket" # corresponds to the SourceBucket deploy parameter
export resolverTemplate="%s.tif" # corresponds to the ResolverTemplate deploy parameter
npm run create-metadata image_id_1 image_id_2 image_id_3

Or to process every file in the bucket, regardless of type:

export sourceBucket="my-image-bucket"
export resolverTemplate="%s"
aws s3 ls --recursive s3://my-image-bucket/ \
  | awk '{ print $4 }' \
  | xargs -n 50 npm run create-metadata

Step 5

Verify the output:

aws s3api head-object --bucket my-image-bucket --key image_id_1.tif

Lambbda Function Invocation

Prerequisites

  • A serverless-iiif application stack deployed with CreateMetadataFunction set to true

Step 1

Get the value of the MetadataFunctionARN output from the deployed stack.

Step 2

Determine the ID of the image (as it will look in the ID part of the IIIF URL).

Step 3

Invoke the Lambda Function with the payload { imageId: "ID_OF_IMAGE" }

S3 Batch Operation Invocation

Prerequisites

  • A serverless-iiif application stack deployed with CreateMetadataFunction set to true

Step 1

Get the value of the MetadataFunctionARN output from the deployed stack.

Step 2

Create an S3 Batch Operation specifying the MetadataFunctionARN as the operation. The manifest must only include objects from the image source bucket, as that is the only bucket the Lambda Function has access to.