[MOD] update to support BaseX 9.4.5 and use thumbnailator 4.13

This commit is contained in:
Andy Bunce 2021-02-16 23:05:20 +00:00
parent 460987bfec
commit 78e8f1b28a
15 changed files with 292 additions and 293 deletions

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src/java"/> <classpathentry kind="src" path="src/java"/>
<classpathentry kind="lib" path="src/main/content/thumbnailator-0.4.8.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes> <attributes>
<attribute name="module" value="true"/> <attribute name="module" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="lib/BaseX924.jar"/> <classpathentry kind="lib" path="lib/BaseX945.jar"/>
<classpathentry kind="lib" path="src/main/content/thumbnailator-0.4.13.jar"/>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>

View file

@ -1,6 +1,6 @@
<xqdoc:xqdoc xmlns:xqdoc="http://www.xqdoc.org/1.0"> <xqdoc:xqdoc xmlns:xqdoc="http://www.xqdoc.org/1.0">
<xqdoc:control> <xqdoc:control>
<xqdoc:date>2018-06-29T19:13:26.072+01:00</xqdoc:date> <xqdoc:date>2021-02-16T23:01:20.669Z</xqdoc:date>
<xqdoc:version>1.1</xqdoc:version> <xqdoc:version>1.1</xqdoc:version>
</xqdoc:control> </xqdoc:control>
<xqdoc:module type="library"> <xqdoc:module type="library">
@ -10,18 +10,18 @@
<xqdoc:description>Generate image thumbnails using the thumbnailator library.</xqdoc:description> <xqdoc:description>Generate image thumbnails using the thumbnailator library.</xqdoc:description>
<xqdoc:see>https://github.com/coobird/thumbnailator</xqdoc:see> <xqdoc:see>https://github.com/coobird/thumbnailator</xqdoc:see>
<xqdoc:author>andy bunce</xqdoc:author> <xqdoc:author>andy bunce</xqdoc:author>
<xqdoc:version>0.5</xqdoc:version> <xqdoc:version>0.6</xqdoc:version>
</xqdoc:comment> </xqdoc:comment>
</xqdoc:module> </xqdoc:module>
<xqdoc:namespaces>
<xqdoc:namespace prefix="thumbnails" uri="expkg-zone58:image.thumbnailator"/>
<xqdoc:namespace prefix="Thumbs" uri="org.expkgzone58.image.Thumbs"/>
</xqdoc:namespaces>
<xqdoc:imports> <xqdoc:imports>
<xqdoc:import type="library"> <xqdoc:import type="library">
<xqdoc:uri>org.expkgzone58.image.Thumbs</xqdoc:uri> <xqdoc:uri>org.expkgzone58.image.Thumbs</xqdoc:uri>
</xqdoc:import> </xqdoc:import>
</xqdoc:imports> </xqdoc:imports>
<xqdoc:namespaces>
<xqdoc:namespace prefix="thumbnails" uri="expkg-zone58:image.thumbnailator"/>
<xqdoc:namespace prefix="Thumbs" uri="org.expkgzone58.image.Thumbs"/>
</xqdoc:namespaces>
<xqdoc:variables/> <xqdoc:variables/>
<xqdoc:functions> <xqdoc:functions>
<xqdoc:function arity="2"> <xqdoc:function arity="2">

BIN
dist/thumbnailator-8.0.1.xar vendored Normal file

Binary file not shown.

BIN
lib/BaseX945.jar Normal file

Binary file not shown.

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?> <?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
<jardesc> <jardesc>
<jar path="ex-thumbnailator/src/main/content/thumbhelper-7.0.0.jar"/> <jar path="ex-thumbnailator/src/main/content/thumbhelper-8.0.0.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/ex-thumbnailator/makejar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/> <options buildIfNeeded="true" compress="true" descriptionLocation="/ex-thumbnailator/makejar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/> <storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/> <selectedProjects/>

View file

@ -64,5 +64,8 @@
<version num="7.0.1"> <version num="7.0.1">
<!-- generated: {fn:current-dateTime()} --> <!-- generated: {fn:current-dateTime()} -->
</version> </version>
<version num="8.0.1">
<!-- generated: {fn:current-dateTime()} -->
</version>
</pkg> </pkg>
</repo> </repo>

View file

@ -1,13 +1,13 @@
# expkg-zone58:image.thumbnailator # expkg-zone58:image.thumbnailator
An XQuery interface to the image thumbnail generator library An XQuery interface to the image thumbnail generator library
[thumbnailator](https://github.com/coobird/thumbnailator) for BaseX 9+. [thumbnailator](https://github.com/coobird/thumbnailator) for BaseX 9.4.5+.
Features size, scale, caption, rotate, flip, colorize, watermark. More details at [doc](doc/readme.md) Features size, scale, caption, rotate, flip, colorize, watermark. More details at [doc](doc/readme.md)
## Versions ## Versions
* For Basex 9+ use thumbnailator 7.0.0+ * thumbnailator 8 requires Basex 9.4.5+
* uses thumbnailator 4.13
## Usage ## Usage
Images are input and output as `xs:base64Binary` items. Inputs typically come from `fetch:binary` Images are input and output as `xs:base64Binary` items. Inputs typically come from `fetch:binary`

View file

@ -9,7 +9,6 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator;
import java.util.List; import java.util.List;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -85,10 +84,8 @@ public class Thumbs extends QueryModule{
// build parameters from XML // build parameters from XML
ThumbnailParameter fromNode(final ANode node) throws QueryException, IOException { ThumbnailParameter fromNode(final ANode node) throws QueryException, IOException {
ThumbnailParameterBuilder builder = new ThumbnailParameterBuilder(); ThumbnailParameterBuilder builder = new ThumbnailParameterBuilder();
for(final ANode element : node.childIter()) {
Iterator<ANode> itr = node.children().iterator();
while (itr.hasNext()) {
ANode element = itr.next();
if (element.kind() == Data.ELEM) { if (element.kind() == Data.ELEM) {
String name = Token.string(element.name()); String name = Token.string(element.name());
// FnTrace.trace(name.getBytes(), "element: ".getBytes(), queryContext); // FnTrace.trace(name.getBytes(), "element: ".getBytes(), queryContext);
@ -169,9 +166,7 @@ public class Thumbs extends QueryModule{
List<ImageFilter> filters(final ANode filters) throws QueryException, IOException { List<ImageFilter> filters(final ANode filters) throws QueryException, IOException {
Pipeline pipeline = new Pipeline(); Pipeline pipeline = new Pipeline();
Iterator<ANode> itr = filters.children().iterator(); for(final ANode node : filters.childIter()) {
while (itr.hasNext()) {
ANode node = itr.next();
if (node.kind() == Data.ELEM) { if (node.kind() == Data.ELEM) {
switch (Token.string(node.name())) { switch (Token.string(node.name())) {

View file

@ -1,5 +1,5 @@
<package xmlns="http://www.basex.org/modules/pkg"> <package xmlns="http://www.basex.org/modules/pkg">
<jar>thumbhelper-7.0.0.jar</jar> <jar>thumbhelper-8.0.0.jar</jar>
<jar>thumbnailator-0.4.8.jar</jar> <jar>thumbnailator-0.4.13.jar</jar>
<class>org.expkgzone58.image.Thumbs</class> <class>org.expkgzone58.image.Thumbs</class>
</package> </package>

Binary file not shown.

Binary file not shown.

View file

@ -2,10 +2,11 @@ xquery version "3.1" encoding "UTF-8";
(:~ Generate image thumbnails using the thumbnailator library. (:~ Generate image thumbnails using the thumbnailator library.
: @see https://github.com/coobird/thumbnailator : @see https://github.com/coobird/thumbnailator
: @author andy bunce : @author andy bunce
: @version 0.5 : @version 0.6
:) :)
module namespace thumbnails = 'expkg-zone58:image.thumbnailator'; module namespace thumbnails = 'expkg-zone58:image.thumbnailator';
import module namespace Thumbs = "org.expkgzone58.image.Thumbs"; import module namespace Thumbs = "org.expkgzone58.image.Thumbs";
(:~ (:~
: generate scaled version of source image with maximum dimension of size : generate scaled version of source image with maximum dimension of size
: @param $source base64Binary (streamed?) e.g from `fetch:binary` : @param $source base64Binary (streamed?) e.g from `fetch:binary`

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="7.0.1" spec="1.0"> abbrev="thumbnailator" version="8.0.1" 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>