fixes
This commit is contained in:
parent
ca25493701
commit
c58304e2ff
BIN
dist/thumbnailator.zar
vendored
BIN
dist/thumbnailator.zar
vendored
Binary file not shown.
27
dist/xqdoc.xml
vendored
27
dist/xqdoc.xml
vendored
@ -1,6 +1,6 @@
|
||||
<xqdoc:xqdoc xmlns:xqdoc="http://www.xqdoc.org/1.0">
|
||||
<xqdoc:control>
|
||||
<xqdoc:date>2013-06-10T22:32:15.559+01:00</xqdoc:date>
|
||||
<xqdoc:date>2013-06-11T22:00:18.42+01:00</xqdoc:date>
|
||||
<xqdoc:version>1.1</xqdoc:version>
|
||||
</xqdoc:control>
|
||||
<xqdoc:module type="library">
|
||||
@ -15,7 +15,8 @@
|
||||
<xqdoc:namespace prefix="thumbnails" uri="apb.image.thumbnailator"/>
|
||||
<xqdoc:namespace prefix="File" uri="java:java.io.File"/>
|
||||
<xqdoc:namespace prefix="Thumbnailator" uri="java:net.coobird.thumbnailator.Thumbnailator"/>
|
||||
<xqdoc:namespace prefix="BufferedImageBuilder" uri="net.coobird.thumbnailator.builders.BufferedImageBuilder"/>
|
||||
<xqdoc:namespace prefix="BufferedImageBuilder" uri="java:net.coobird.thumbnailator.builders.BufferedImageBuilder"/>
|
||||
<xqdoc:namespace prefix="Builder" uri="java:net.coobird.thumbnailator.Thumbnails$Builder"/>
|
||||
</xqdoc:namespaces>
|
||||
<xqdoc:imports/>
|
||||
<xqdoc:variables/>
|
||||
@ -30,6 +31,28 @@
|
||||
</xqdoc:parameter>
|
||||
</xqdoc:parameters>
|
||||
</xqdoc:function>
|
||||
<xqdoc:function arity="4">
|
||||
<xqdoc:name>sourceRegion</xqdoc:name>
|
||||
<xqdoc:signature>declare function sourceRegion($x as xs:integer, $y as xs:integer, $width as xs:integer, $height as xs:integer)</xqdoc:signature>
|
||||
<xqdoc:parameters>
|
||||
<xqdoc:parameter>
|
||||
<xqdoc:name>x</xqdoc:name>
|
||||
<xqdoc:type>xs:integer</xqdoc:type>
|
||||
</xqdoc:parameter>
|
||||
<xqdoc:parameter>
|
||||
<xqdoc:name>y</xqdoc:name>
|
||||
<xqdoc:type>xs:integer</xqdoc:type>
|
||||
</xqdoc:parameter>
|
||||
<xqdoc:parameter>
|
||||
<xqdoc:name>width</xqdoc:name>
|
||||
<xqdoc:type>xs:integer</xqdoc:type>
|
||||
</xqdoc:parameter>
|
||||
<xqdoc:parameter>
|
||||
<xqdoc:name>height</xqdoc:name>
|
||||
<xqdoc:type>xs:integer</xqdoc:type>
|
||||
</xqdoc:parameter>
|
||||
</xqdoc:parameters>
|
||||
</xqdoc:function>
|
||||
<xqdoc:function arity="3">
|
||||
<xqdoc:name>size</xqdoc:name>
|
||||
<xqdoc:signature>declare function size($builder, $width as xs:int, $height as xs:int)</xqdoc:signature>
|
||||
|
@ -1,5 +1,5 @@
|
||||
# apb.image.thumbnailator
|
||||
An XQuery interface to the thumbnail generator
|
||||
An XQuery interface to the thumbnail generator library
|
||||
[thumbnailator](http://code.google.com/p/thumbnailator/)
|
||||
|
||||
BaseX 7.7 or greater is required.
|
||||
@ -19,3 +19,6 @@ t:make("/tmp/pic.jpg","/tmp/small.jpg",120,120)
|
||||
````
|
||||
# Tests
|
||||
The `test.xq` script uses the BaseX [Unit module](http://docs.basex.org/wiki/Unit_Module)
|
||||
todo
|
||||
#
|
||||
explore java binding limits and fluent interface
|
@ -7,7 +7,8 @@ declare default function namespace 'apb.image.thumbnailator';
|
||||
|
||||
declare namespace File="java:java.io.File";
|
||||
declare namespace Thumbnailator="java:net.coobird.thumbnailator.Thumbnailator";
|
||||
declare namespace BufferedImageBuilder="net.coobird.thumbnailator.builders.BufferedImageBuilder";
|
||||
declare namespace BufferedImageBuilder="java:net.coobird.thumbnailator.builders.BufferedImageBuilder";
|
||||
declare namespace Builder="java:net.coobird.thumbnailator.Thumbnails$Builder";
|
||||
(:
|
||||
Thumbnails.of(new File("path/to/directory").listFiles())
|
||||
.size(640, 480)
|
||||
@ -15,7 +16,13 @@ Thumbnails.of(new File("path/to/directory").listFiles())
|
||||
.toFiles(Rename.PREFIX_DOT_THUMBNAIL);
|
||||
:)
|
||||
declare function fromFilenames($file as xs:string){
|
||||
thumbnails:fromFilenames($file)
|
||||
let $a:=File:new(file:path-to-native($file))
|
||||
return Builder:of(($a,$a))
|
||||
};
|
||||
|
||||
declare function sourceRegion($x as xs:integer,$y as xs:integer,
|
||||
$width as xs:integer,$height as xs:integer){
|
||||
Builder:sourceRegion(xs:int($x),xs:int($y),xs:int($width),xs:int($height))
|
||||
};
|
||||
|
||||
declare function size($builder,$width as xs:int,$height as xs:int){
|
||||
@ -26,7 +33,7 @@ declare function make($src as xs:string,
|
||||
$dest as xs:string,
|
||||
$width as xs:integer,
|
||||
$height as xs:integer){
|
||||
let $src:=File:new($src)
|
||||
let $dest:=File:new($dest)
|
||||
let $src:=File:new(file:path-to-native($src))
|
||||
let $dest:=File:new(file:path-to-native($dest))
|
||||
return Thumbnailator:createThumbnail($src,$dest,xs:int($width),xs:int($height))
|
||||
};
|
BIN
src/test/out.jpg
Normal file
BIN
src/test/out.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
@ -1,7 +1,7 @@
|
||||
(:~
|
||||
: unit tests for thumbnail module
|
||||
:)
|
||||
import module namespace t="apb.image.thumbnails" at "../main/content/thumbnailator.xqm";
|
||||
import module namespace t="apb.image.thumbnailator" at "../main/content/thumbnailator.xqm";
|
||||
|
||||
declare variable $pic1:=resolve-uri("simple.jpg");
|
||||
declare variable $picr:=resolve-uri("out.jpg");
|
||||
@ -34,7 +34,8 @@ declare
|
||||
declare
|
||||
%unit:test
|
||||
function local:success-function() {
|
||||
unit:assert(t:make($pic1,$picr,60,60))
|
||||
let $r:=t:make($pic1,$picr,60,60)
|
||||
return unit:assert(fn:empty($r))
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user