[fix] thumbnail element

This commit is contained in:
Andy Bunce 2017-04-21 15:06:49 +01:00
parent 57f3c1eee7
commit 3376e6e4db
3 changed files with 13 additions and 6 deletions

View file

@ -13,16 +13,20 @@ Tested against BaseX 8.6.2
import module namespace t="expkg-zone58:image.thumbnailator"; import module namespace t="expkg-zone58:image.thumbnailator";
fetch:binary("http://images.metmuseum.org/CRDImages/ep/original/DT46.jpg") fetch:binary("http://images.metmuseum.org/CRDImages/ep/original/DT46.jpg")
=>t:scale(80,60) =>t:size(80,60)
``` ```
### Tasks ### Tasks
This function takes an XML description of the operations to apply to generate the thumbnail. This function takes an XML description of the operations to apply to generate the thumbnail.
```xml ```xquery
import module namespace t="expkg-zone58:image.thumbnailator";
declare variable $watermark:="C:\Users\andy\git\ex-thumbnailator\src\test\resources\icon.jpg";
let $task:=
<thumbnail> <thumbnail>
<size width="500" height="500"/> <size width="100" height="100"/>
<filters> <filters>
<colorize color="green" alpha=".5"/> <colorize color="green" alpha=".5"/>
<caption position="CENTER">Some Text here</caption> <caption position="CENTER">Some Text here</caption>
@ -31,8 +35,11 @@ This function takes an XML description of the operations to apply to generate th
<watermark src="{$watermark}" alpha=".5" position="TOP_LEFT"/> <watermark src="{$watermark}" alpha=".5" position="TOP_LEFT"/>
</filters> </filters>
</thumbnail> </thumbnail>
return fetch:binary("http://images.metmuseum.org/CRDImages/ep/original/DT46.jpg")
=>t:task($task)
``` ```
A schema is provided. A schema for this is [provided](./src/content/task.xsd)
## Installation ## Installation
The library is packaged in the [EXpath](http://expath.org/spec/pkg) xar format with The library is packaged in the [EXpath](http://expath.org/spec/pkg) xar format with

View file

@ -34,7 +34,7 @@ as xs:base64Binary
: @result base64Binary for thumbnail : @result base64Binary for thumbnail
:) :)
declare function thumbnails:task($source as xs:base64Binary, declare function thumbnails:task($source as xs:base64Binary,
$task as element(task)) $task as element(thumbnail))
as xs:base64Binary as xs:base64Binary
{ {
Q{java:org.expkgzone58.image.Thumbs}task($source,$task) Q{java:org.expkgzone58.image.Thumbs}task($source,$task)

View file

@ -1,5 +1,5 @@
<package xmlns="http://expath.org/ns/pkg" name="https://github.com/expkg-zone58/ex-thumbnailator" <package xmlns="http://expath.org/ns/pkg" name="https://github.com/expkg-zone58/ex-thumbnailator"
abbrev="thumbnailator" version="4.1.4" spec="1.0"> abbrev="thumbnailator" version="4.1.5" spec="1.0">
<title>An XQuery interface to thumbnailator the thumbnail generator library.</title> <title>An XQuery interface to thumbnailator the thumbnail generator library.</title>
<dependency processor="basex" /> <dependency processor="basex" />