Mercurial > hg > digilib
changeset 1637:248c7df143cf release-2.5
Merge from HEAD
3972535c1146ebfb4619eb99daab73a656bdb534
author | robcast |
---|---|
date | Mon, 12 Jun 2017 16:04:44 +0200 |
parents | ba6e93840f38 (current diff) 3972535c1146 (diff) |
children | dc440131299b |
files | common/doc/Scaler.html webapp/src/main/webapp/WEB-INF/digilib-config.xml.off |
diffstat | 5 files changed, 130 insertions(+), 164 deletions(-) [+] |
line wrap: on
line diff
--- a/common/doc/Scaler.html Fri Jun 02 12:44:58 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -<title>Scaler servlet</title> -</head> -<body> -<h1>Scaler</h1> - -<p>A Servlet for scaling images. (Version 1.5.2)</p> - -<h2>Web API</h2> - -<p>The Scaler servlet takes parameters in the http request format: -<code>Scaler/request_path/?param1=value1&param2=value2&...</code> -Unknown parameters will be silently ignored.</p> - -<p>Recognised parameters:</p> -<ul> - <li><b>request_path</b> path to file or directory.</li> - - <li><b>fn</b> path to file or directory below <code>/docuserver/images</code> - (or other configured image directory). - This path will be added to the <code>request_path</code> behind the servlet name. - Either parameter can be empty.</li> - - <li><b>pn</b> page number. Index into the (alphabetically sorted) directory - given by the path. Starts with 1. Ignored if the path points to a file. - Default: 1.</li> - - <li><b>dw</b> destination image width (pixels). If omitted the image is scaled to fit - dh.</li> - - <li><b>dh</b> destination image height (pixels). If omitted the image is scaled to fit - dw.</li> - - <li><b>wx</b> relative x offset of the image area to be sent (0 <= wx <= 1). - Default: 0.</li> - - <li><b>wy</b> relative y offset of the image area to be sent (0 <= wy <= 1). - Default: 0.</li> - - <li><b>ww</b> relative width of the image area to be sent (0 <= ww <= 1). - Default: 1.</li> - - <li><b>wh</b> relative height of the image area to be sent (0 <= wh <= 1). - Default: 1.</li> - - <li><b>ws</b> additional scaling factor. The resulting image will have the size - <code>[ws*dw,ws*dh]</code>. Default: 1.</li> - - <li><b>mo</b> flags for the mode of operation separated by ",". - <ul> - <li><b>fit</b>: always scale the image to fit - <code>[dw,dh]</code> (default).<br> - - <b>clip</b>: send the file in its - original resolution, cropped to fit <code>[dw,dh]</code>. - <br> - - <b>osize</b>: scale to original size based on the image resolution - (from the image metadata) and display resolution (from parameter - <code>ddpi</code>). Fails if either resolution is unknown. - </li> - - <li> - <b>file</b>: send the file as-is (may - be very large and all sorts of image types!). If configuration - doesn't allow sending files - (<code>sendfile-allowed=false</code>) revert to - <code>clip</code>.<br> - - <b>rawfile</b>: send the file as-is with a mime-type of - <code>application/octet-stream</code> so it can be downloaded with - the browser. - </li> - - <li><b>errtxt</b>: send error response as HTML.<br> - <b>errimg</b>: response as image (default).</li> - - <li><b>q0</b>-<b>q2</b>: quality of interpolation in scaling - (<code>q0</code>: worst, default).</li> - - <li><b>lores</b>: try to use scaled image (default)<br> - - <b>hires</b>: always use unscaled image.<br> - - If the image is zoomed (ww, wh < 1) the use of the scaled - image files depends on the requested resolution.</li> - - <li><b>vmir</b>: mirror image vertically.<br> - - <b>hmir</b>: mirror image horizontally.</li> - - <li><b>jpg</b>: the resulting image is always sent as JPEG - (otherwise TIFF and PNG images are sent as PNG). - </li> - </ul> - </li> - - <li><b>cont</b>: change contrast of the image. Negative value - reduces contrast, positive value enhances contrast. Pixel value is - multiplied by 2^cont. Default: 0</li> - - <li><b>brgt</b>: change brightness of image. Negative value reduces - brightness, positive value enhances brightness. The value brgt is - added to the pixel value. Default: 0</li> - - <li><b>rot</b>: rotate image. Rotation angle is given in - degrees. Default: 0</li> - - <li><b>rgbm</b>: modify color by multiplication. The contrast of the - red green and blue components of the image can be reduced or - enhanced similar to the <code>cont</code> parameter. The factors for - red, green and blue are separated by slashes (for example - 0.86/0/-0.5). Default: 0/0/0</li> - - <li><b>rgba</b>: modify color by addition. The brightness of the red - green and blue components of the image can be reduced or enhanced - similar to the <code>brgt</code> parameter. The factors for red, - green and blue are separated by slashes (for example - 100/0/25). Default: 0/0/0</li> - - <li><b>ddpi</b>: resolution of client display for <code>osize</code> mode. - Either <code>ddpi</code> or <code>ddpix</code> and <code>ddpiy</code> must - be set to use <code>osize</code> mode.</li> - - <li><b>ddpix</b>: resolution of client display in x direction for - <code>osize</code> mode.</li> - - <li><b>ddpiy</b>: resolution of client display in y direction for - <code>osize</code> mode.</li> - -</ul> - - <p>The image to be loaded can be specified by the - <code>request_path</code> (deprecated) or the <code>fn</code> - (preferred) parameter and the optional index <code>pn</code></p> - <ul> - <li> if <code>fn</code> points to a directory then the file with - the index <code>pn</code> (in alphabetical order according to - ASCII) will be loaded</li> - - <li>if <code>fn</code> points to a file (with or without - extension) then this file will be loaded</li> - </ul> - - <p>The image will be scaled equally in horizontal and vertical - direction such that the resulting image does not exceed the rectangle - <code>[dw,dh]</code>. If only either height or width is given the - image is scaled to match only the given parameter. The size of the - resulting image in the other parameter is determined by the aspect - ratio of the image. - </p> - -</body> -</html>
--- a/common/src/main/java/digilib/conf/DigilibRequest.java Fri Jun 02 12:44:58 2017 +0200 +++ b/common/src/main/java/digilib/conf/DigilibRequest.java Mon Jun 12 16:04:44 2017 +0200 @@ -355,7 +355,7 @@ /* * parse sequence of parameters as IIIF image API */ - String identifier = null; + String identifier = ""; // empty name means image root directory String region = null; String size = null; String rotation = null;
--- a/doc/src/site/markdown/iiif-api.md Fri Jun 02 12:44:58 2017 +0200 +++ b/doc/src/site/markdown/iiif-api.md Mon Jun 12 16:04:44 2017 +0200 @@ -1,8 +1,10 @@ # The digilib IIIF API +## IIIF Image API + The Scaler servlet provides not only its native [Scaler API](scaler-api.html) but also an API compliant to the standards of the International Image Interoperability Framework http://iiif.io. -As of version 2.3.7 digilib supports the [IIIF Image API version 2](http://iiif.io/api/image/2.0/) at [compliance level 2](http://iiif.io/api/image/2.0/compliance.html). You can switch between API version 1.1 and 2.0 support with the `iiif-api-version` parameter in [digilib-config](digilib-config.html), +As of version 2.3.7 digilib supports the [IIIF Image API version 2](http://iiif.io/api/image/2.1/) at [compliance level 2](http://iiif.io/api/image/2.0/compliance.html). You can switch between API version 1.1 and 2.0 support with the `iiif-api-version` parameter in [digilib-config](digilib-config.html), IIIF Image API URLs for an image request have the form: @@ -23,3 +25,23 @@ An info request URL for the same image looks like: http://www.example.org/digilib/Scaler/IIIF/books!book1!page0002/info.json + +## IIIF Presentation API + +As of version 2.5.3 digilib provides the optional Manifester servlet that generates simple [IIIF Presentation API version 2](http://iiif.io/api/presentation/2.1) manifests that can be used with any [IIIF viewer](http://iiif.io/apps-demos/#image-viewing-clients) to navigate a directory full of images with the functions of a book-reader or light-table. + +To build digilib with the Manifester servlet you need to add the `iiif-presentation` profile to your Maven build: + + mvn -Piiif-presentation package + +(or use the digilib-webapp-X.X.X-srv3p.war file from the website) + +The Manifester servlet URLs have the form: + + http[s]://{server}/{digilib-webapp}/Manifester/{iiif-prefix}/{identifier} + +So you can get a manifest for all images in the directory `/books/book1` with a URL like: + + http://www.example.org/digilib/Manifester/IIIF/books!book1 + +To try out a viewer on your manifest you can go to the website of the Universal Viewer [http://universalviewer.io/](http://universalviewer.io/) and enter the URL of your manifest in the "view a manifest" box on the page. This will work even with a local digilib installation since the Javascript in your Browser reads and interprets the manifest.
--- a/iiif-presentation/src/main/java/digilib/servlet/Manifester.java Fri Jun 02 12:44:58 2017 +0200 +++ b/iiif-presentation/src/main/java/digilib/servlet/Manifester.java Mon Jun 12 16:04:44 2017 +0200 @@ -202,11 +202,9 @@ return; } // get identifier (first parameter) - String identifier = iiifParams.get(0); - if (identifier == null) { - logger.error("IIIF identifier missing"); - response.sendError(HttpServletResponse.SC_BAD_REQUEST, "IIIF identifier missing."); - return; + String identifier = ""; // allow empty identifier for image root dir + if (iiifParams.size() > 0) { + identifier = iiifParams.get(0); } // decode identifier to file path dlRequest.setValueFromString("fn", dlRequest.decodeIiifIdentifier(identifier));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/WEB-INF/digilib-config.xml.off Mon Jun 12 16:04:44 2017 +0200 @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Digilib servlet config file --> +<!-- rename this file to digilib-config.xml --> + +<digilib-config> + <!-- Image to be sent to indicate an error or general failure. --> + <parameter name="error-image" value="img/digilib-error.png" /> + + <!-- Image to be sent to indicate an authorization failure. --> + <parameter name="denied-image" value="img/digilib-denied.png" /> + + <!-- Image to be sent to indicate that the request was correct, but the specified image could not be found. --> + <parameter name="notfound-image" value="img/digilib-notfound.png" /> + + <!-- List of directories where images are searched. + Directories with low-resolution images are LAST!!! in list. + Use OS-specific path separators (":" for Unix, ";" for Windows) --> + <!-- <parameter name="basedir-list" value="sample-images" /> --> + <parameter name="basedir-list" value="/docuserver/images:/docuserver/scaled/small:/docuserver/scaled/thumb" /> + + <!-- Java class to use for image operations --> + <parameter name="docuimage-class" value="digilib.image.ImageLoaderDocuImage" /> + + <!-- mimimum amount of scaling done with antialiasing --> + <parameter name="subsample-minimum" value="2"/> + + <!-- default interpolation quality (0=worst) --> + <parameter name="default-quality" value="2"/> + + <!-- is sending whole image files with mo=file allowed? --> + <parameter name="sendfile-allowed" value="true" /> + + <!-- the a maximum size of any sent image. (0 means no limit) --> + <parameter name="max-image-size" value="0" /> + + <!-- number of working threads --> + <parameter name="worker-threads" value="2" /> + + <!-- number of waiting requests in queue --> + <parameter name="max-waiting-threads" value="20" /> + + <!-- timeout for asynchronous servlet worker (ms) --> + <parameter name="worker-timeout" value="60000" /> + + <!-- Java class to use for file metadata --> + <parameter name="filemeta-class" value="digilib.meta.IndexMetaFileMeta" /> + + <!-- Java class to use for directory metadata --> + <parameter name="dirmeta-class" value="digilib.meta.IndexMetaDirMeta" /> + + <!-- Restrict access to authorized users. + User authentication and roles are provided by the servlet container + (see tomcat-users.xml). + Authorization for resources (directories) is evaluated by the servlet + (see auth-file). --> + <parameter name="use-authorization" value="true" /> + + <!-- Java class to use for authentication --> + <parameter name="authnops-class" value="digilib.auth.IpOpenIdAuthnOps" /> + + <!-- Java class to use for authorization --> + <parameter name="authzops-class" value="digilib.auth.MetaAccessAuthzOps" /> + + <!-- URL location of XML file with authorization requirements. --> + <parameter name="auth-file" value="digilib-auth.xml" /> + + <!-- use mapping of "virtual directories" to real directories on the server --> + <parameter name="use-mapping" value="false"/> + + <!-- location of XML mapping file --> + <parameter name="mapping-file" value="digilib-map.xml"/> + + <!-- location of logger config file --> + <parameter name="log-config-file" value="log4j-config.xml"/> + + <!-- is the image toolkit allowed to use a disk cache --> + <parameter name="img-diskcache-allowed" value="false"/> + + + <!-- location for PDF files while still in progress --> + <parameter name="pdf-temp-dir" value="/tmp/pdf_tmp" /> + + <!-- location for PDF files upon completion --> + <parameter name="pdf-cache-dir" value="/tmp/pdf_cache"/> + + <!-- number of PDF generation threads --> + <parameter name="pdf-worker-threads" value="1" /> + + <!-- number of waiting PDF requests in queue --> + <parameter name="pdf-max-waiting-threads" value="20" /> + + <!-- number of image generation threads for PDF --> + <parameter name="pdf-image-worker-threads" value="1" /> + + <!-- number of waiting image requests for PDF in queue --> + <parameter name="pdf-image-max-waiting-threads" value="10" /> + + <!-- logo for PDFs --> + <parameter name="pdf-logo" value="http://digilib.berlios.de/images/digilib-logo-big.png" /> + + <!-- image hacks --> + <!-- <parameter name="docuimage-hacks" value="setDestForScale=false,setDestForBlur=false,setDestSrgb=false" /> --> +</digilib-config>