From 332c058bd407c4b6fb30e6bf32b634a72bc68e05 Mon Sep 17 00:00:00 2001
From: ulrich <undisclosed>
Date: Fri, 17 Jan 2020 16:31:42 +0000
Subject: [PATCH] Thumbnails werden nun im jeweiligen Bildordner mit abgelegt und nicht jedesmal 'on the fly' erzeugt.

---
 src/java/de/uhilger/filecms/api/FileMgr.java |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/java/de/uhilger/filecms/api/FileMgr.java b/src/java/de/uhilger/filecms/api/FileMgr.java
index 32c3a54..d62cbb9 100644
--- a/src/java/de/uhilger/filecms/api/FileMgr.java
+++ b/src/java/de/uhilger/filecms/api/FileMgr.java
@@ -21,8 +21,15 @@
 import de.uhilger.filecms.data.FileRef;
 import de.uhilger.filecms.pub.AbstractComparator;
 import de.uhilger.filecms.pub.FileNameComparator;
+import de.uhilger.filecms.pub.ImgFileFilter;
 import de.uhilger.wbx.Bild;
+import de.uhilger.wbx.WbxUtils;
+import static de.uhilger.wbx.WbxUtils.EMPTY_STRING;
+import static de.uhilger.wbx.WbxUtils.WBX_FILE_BASE;
+import de.uhilger.wbx.data.Inhalt;
+import de.uhilger.wbx.web.TNServlet;
 import java.io.File;
+import java.io.FileFilter;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -34,6 +41,8 @@
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
@@ -44,6 +53,7 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 import java.util.zip.ZipOutputStream;
+import javax.servlet.http.HttpServletRequest;
 import net.coobird.thumbnailator.Thumbnails;
 import org.apache.commons.io.FileUtils;
 
@@ -117,7 +127,7 @@
         logger.fine("listing path: " + path);
         File dir = new File(path);
         if (dir.exists()) {
-          File[] fileArray = dir.listFiles();
+          File[] fileArray = dir.listFiles(new ImgFileFilter());
           if (orderBy != null && orderBy.equalsIgnoreCase("name")) {
             Arrays.sort(fileArray, new FileNameComparator(order));
           } else {
@@ -143,7 +153,15 @@
     }
     return files;
   }
-  
+
+  public List<Inhalt> collect(String relativePath, int maxTiefe, int maxAnzahl, int len) {
+    
+    WbxUtils wu = new WbxUtils();
+    HttpServletRequest req = getRequest();
+    String requestUrl = req.getRequestURL().toString();
+    String contextPath = req.getContextPath();
+    return wu.collectFiles(requestUrl, contextPath, relativePath, maxTiefe, maxAnzahl, len);
+  }
   
   public FileRef newFolder(String relPath, String folderName) {
     if (!relPath.startsWith(".")) {

--
Gitblit v1.9.3