From 0856674e198c285173844de673445300e62daed9 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Thu, 13 Mar 2025 16:35:31 +0000
Subject: [PATCH] Bilddatei rotieren hinzugefuegt
---
src/de/uhilger/neon/fm/package-info.java | 1 +
src/de/uhilger/neon/fm/FileManipulator.java | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/src/de/uhilger/neon/fm/FileManipulator.java b/src/de/uhilger/neon/fm/FileManipulator.java
index e5eba39..93a0694 100644
--- a/src/de/uhilger/neon/fm/FileManipulator.java
+++ b/src/de/uhilger/neon/fm/FileManipulator.java
@@ -25,7 +25,10 @@
import de.uhilger.fm.Renamer;
import de.uhilger.fm.Inflator;
import de.uhilger.fm.Deflator;
+import de.uhilger.fm.Rotor;
+import java.io.File;
import java.io.IOException;
+import net.coobird.thumbnailator.Thumbnails;
/**
* Aenderungen an bestehenden Dateien.
@@ -41,6 +44,7 @@
private static final String P_DUPLICATE = "duplicate";
private static final String P_ZIP = "zip";
private static final String P_UNZIP = "unzip";
+ private static final String P_ROTATE = "rotate";
/**
* <p>
@@ -90,6 +94,8 @@
* HTTP PUT /pfad/zum/ordner?zip' packt den Ordner
*
* HTTP PUT /pfad/zur/datei.zip?unzip' entpackt eine Datei
+ *
+ * HTTP PUT /pfad/zur/datei.jpg?rotate=180 rotiert eine Bilddatei (- links, sonst rechts)
*
* Eine Dateiliste im Body sieht z.B. wie folgt aus
* ["test.txt","dok","weitere-datei.bin","bild.jpg"]
@@ -133,6 +139,11 @@
//String path = exchange.getRequestURI().toString();
zipAntwort(exchange, new Inflator().extractZipfile(fileName, /*path,*/ base));
break;
+ case P_ROTATE:
+ Rotor r = new Rotor();
+ r.rotateImgFiles(file, Integer.parseInt(params[1]));
+ antwort(exchange, HttpResponder.SC_OK, fileName + " rotiert.");
+ break;
default:
antwort(exchange, HttpResponder.SC_NOT_FOUND, "ungueltige Anfrage");
break;
@@ -144,7 +155,7 @@
speichern(exchange);
}
}
- } catch (IOException | IllegalArgumentException ex) {
+ } catch (Exception ex) {
fehlerAntwort(exchange, ex);
} finally {
free();
@@ -169,4 +180,6 @@
antwort(exchange, HttpResponder.SC_UNPROCESSABLE_ENTITY, antw);
}
}
+
+
}
diff --git a/src/de/uhilger/neon/fm/package-info.java b/src/de/uhilger/neon/fm/package-info.java
index 67d611c..02fb08c 100644
--- a/src/de/uhilger/neon/fm/package-info.java
+++ b/src/de/uhilger/neon/fm/package-info.java
@@ -21,6 +21,7 @@
* - einzelne Datei umbenennen (?renameTo) Renamer
* - Ordner packen (?zip) Deflator
* - Zip-Datei entpacken (?unzip) Inflator
+ * - Bilddatei rotieren (?rotate) Rotor
*
* POST (Klasse FileCreator)
* - Datei neu anlegen, unter neuem Namen, wenn schon existent (URL ohne Slash am Ende)
--
Gitblit v1.9.3