2016-04-16 22:21:17 +01:00
|
|
|
# expkg-zone58.image.thumbnailator
|
2013-06-11 22:03:12 +01:00
|
|
|
An XQuery interface to the thumbnail generator library
|
2017-04-21 14:48:37 +01:00
|
|
|
[thumbnailator](https://github.com/coobird/thumbnailator).
|
2013-06-10 22:35:14 +01:00
|
|
|
|
2017-04-21 14:48:37 +01:00
|
|
|
Tested against BaseX 8.6.2
|
2013-06-10 22:35:14 +01:00
|
|
|
|
|
|
|
|
2017-04-21 14:48:37 +01:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
### Simple
|
|
|
|
|
|
|
|
```xquery
|
|
|
|
import module namespace t="expkg-zone58:image.thumbnailator";
|
|
|
|
|
|
|
|
fetch:binary("http://images.metmuseum.org/CRDImages/ep/original/DT46.jpg")
|
|
|
|
=>t:scale(80,60)
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
### Tasks
|
|
|
|
This function takes an XML description of the operations to apply to generate the thumbnail.
|
|
|
|
|
|
|
|
```xml
|
|
|
|
<thumbnail>
|
|
|
|
<size width="500" height="500"/>
|
|
|
|
<filters>
|
|
|
|
<colorize color="green" alpha=".5"/>
|
|
|
|
<caption position="CENTER">Some Text here</caption>
|
|
|
|
<rotate angle="15"/>
|
|
|
|
<canvas height="500" width="500" position="TOP_LEFT" color="black"/>
|
|
|
|
<watermark src="{$watermark}" alpha=".5" position="TOP_LEFT"/>
|
|
|
|
</filters>
|
|
|
|
</thumbnail>
|
|
|
|
```
|
|
|
|
A schema is provided.
|
|
|
|
|
|
|
|
## Installation
|
2013-06-10 22:35:14 +01:00
|
|
|
The library is packaged in the [EXpath](http://expath.org/spec/pkg) xar format with
|
2017-04-21 14:48:37 +01:00
|
|
|
the thumbnailator jar included. See releases for installation instructions.
|
|
|
|
|
2013-06-10 22:35:14 +01:00
|
|
|
# Tests
|
2016-04-16 22:21:17 +01:00
|
|
|
`test.xqm` script uses the BaseX [Unit module](http://docs.basex.org/wiki/Unit_Module)
|
|
|
|
|
2017-04-21 14:48:37 +01:00
|
|
|
## License
|
|
|
|
|
|
|
|
* ex-thumbnailator Copyright (c) 2017, Andy Bunce. (Apache 2 License).
|
|
|
|
* thumbnailator Copyright (c) Chris Kroells (MIT License).
|
|
|
|
|
2016-04-16 22:21:17 +01:00
|
|
|
# todo
|
|
|
|
|
2017-04-21 14:48:37 +01:00
|
|
|
scale sourceregion
|