yale-web-technologies / iiif-manifest-generator Goto Github PK
View Code? Open in Web Editor NEWPHP library to generate Manifest files
License: GNU General Public License v3.0
PHP library to generate Manifest files
License: GNU General Public License v3.0
Not hugely urgent. But docs/graphs/classes.svg
is missing from the repository.
At present validation requires that all sequences contain a canvas. It also specifies that in a manifest a sequence after the first one may only contain 'id', 'type' and 'label'.
Unless i'm doing something wrong, the 'isTopLevel' property appears to have no effect on either of these requirements, making the circular logic impossible to follow.
I believe that for this to work in Resources/Sequence.php
the 'Canvases must be present in a sequence' requirement needs moving into the 'isTopLevel' clause?
I think the fix for this is to add a memberDataOnly
clause to the top of the sequence::toArray
method:
if ($this->getOnlyMemberData()) {
ArrayCreator::addRequired($item, Identifier::ID, $this->getID(), "The id must be present in a Manifest");
ArrayCreator::addRequired($item, Identifier::TYPE, $this->getType(), "The type must be present in a Manifest");
ArrayCreator::addRequired($item, Identifier::LABEL, $this->getLabels(), "The label must be present in a Manifest");
return $item;
}
Then add getOnlyMemberData
to the manifest::validateSequence exclusions:
public function validateSequence(Sequence $sequence)
{
$classname = '\IIIF\PresentationAPI\Resources\Sequence';
$exclusions = array(
'getID',
'getType',
'getLabels',
'getDefaultContext',
**'getOnlyMemberData'**
);
$message = "A Sequence after the first one embedded within a Manifest should only contain an id, type and label";
Validator::shouldNotContainItems($sequence, $classname, $exclusions, $message);
Validator::shouldContainItems($sequence, array('getLabels'), 'Multiple Sequences within a Manifest must contain a label');
}
And then for ease of use we can automate setting onlyMemberData on every sequence after the first in manifest.php:
/**
* Add a sequence to the manifest.
*
* @param \IIIF\PresentationAPI\Resources\Sequence $sequence
*/
public function addSequence(Sequence $sequence)
{
if (count($this->sequences)) {
$sequence->returnOnlyMemberData();
}
array_push($this->sequences, $sequence);
}
If i'm misunderstanding something please let me know.
In the 10th line of the example, should
$thumbnail->setService($service_thumbnail);
actually be
$manifest->setService($service_thumbnail);
This is a really cool library -- hoping to use it for our organization's IIIF implementation.
It would be great if the lib would support iiif v3.
The testCreateManifest1
--- Expected
+++ Actual
@@ @@
{
"@context": "http:\/\/iiif.io\/api\/presentation\/2\/context.json",
"@id": "http:\/\/example.org\/iiif\/book1\/manifest",
"@type": "sc:Manifest",
+ "viewingHint": "paged",
+ "viewingDirection": "right-to-left",
+ "navDate": "1856-01-01T00:00:00Z",
@@ @@
- }
+ },
+ "@type": "dctypes:Image"
},
- "viewingDirection": "right-to-left",
- "viewingHint": "paged",
- "navDate": "1856-01-01T00:00:00Z",
@@ @@
+ "rendering": {
+ "@id": "http:\/\/example.org\/iiif\/book1.pdf",
+ "label": "Download as PDF",
+ "format": "application\/pdf"
+ },
@@ @@
- "rendering": {
- "@id": "http:\/\/example.org\/iiif\/book1.pdf",
- "label": "Download as PDF",
- "format": "application\/pdf"
- },
@@ @@
- "label": "p. 1",
+ "height": 500,
"width": 500,
- "height": 500
+ "label": "p. 1"
/app/tests/IIIF/Test/Integration/ManifestTest.php:148
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.