From 528185db53cfa561b0469ed05a0c6c774e2690b6 Mon Sep 17 00:00:00 2001 From: ulrich Date: Thu, 07 Nov 2024 09:03:13 +0000 Subject: [PATCH] Konstanten hinzugefuegt --- src/de/uhilger/neon/image/ImageWorker.java | 43 ++++++++++++++++++++++--------------------- 1 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/de/uhilger/neon/image/ImageWorker.java b/src/de/uhilger/neon/image/ImageWorker.java index 97bedcb..d5080cb 100644 --- a/src/de/uhilger/neon/image/ImageWorker.java +++ b/src/de/uhilger/neon/image/ImageWorker.java @@ -55,27 +55,27 @@ public static final String PNG = ".png"; public void createImages(String baseDir, String fName, String uriStr) throws IOException { - if(uriStr.endsWith(ImageWorker.JPG) || uriStr.endsWith(ImageWorker.JPEG) || uriStr.endsWith(ImageWorker.PNG)) { + //if(uriStr.endsWith(ImageWorker.JPG) || uriStr.endsWith(ImageWorker.JPEG) || uriStr.endsWith(ImageWorker.PNG)) { File dir = new File(baseDir); File imgfile = new File(dir, fName); - ImageWorker actor = new ImageWorker(); - if(uriStr.contains(ImageWorker.TN)) { - actor.createImage(dir, fName, ImageWorker.TN, 120, imgfile); - } else if(uriStr.contains(ImageWorker.KL)) { - actor.createImage(dir, fName, ImageWorker.KL, 240, imgfile); - } else if(uriStr.contains(ImageWorker.SM)) { - actor.createImage(dir, fName, ImageWorker.SM, 500, imgfile); - } else if(uriStr.contains(ImageWorker.MT)) { - actor.createImage(dir, fName, ImageWorker.MT, 700, imgfile); - } else if(uriStr.contains(ImageWorker.GR)) { - actor.createImage(dir, fName, ImageWorker.GR, 1200, imgfile); - } else if(uriStr.contains(ImageWorker.B64)) { + //ImageWorker actor = new ImageWorker(); + if(uriStr.contains(TN)) { + createImage(dir, fName, TN, 120, imgfile); + } else if(uriStr.contains(KL)) { + createImage(dir, fName, KL, 240, imgfile); + } else if(uriStr.contains(SM)) { + createImage(dir, fName, SM, 500, imgfile); + } else if(uriStr.contains(MT)) { + createImage(dir, fName, MT, 700, imgfile); + } else if(uriStr.contains(GR)) { + createImage(dir, fName, GR, 1200, imgfile); + } else if(uriStr.contains(B64)) { File b64File = imgfile; - String fromName = fName.replace(ImageWorker.B64, ""); + String fromName = fName.replace(B64, ""); File fromfile = new File(dir, fromName); - actor.b64Image(fromfile, b64File); + b64Image(fromfile, b64File); } - } + //} } /** @@ -138,11 +138,12 @@ public void setImgSrc(Datei datei, String ext, File b64File) throws IOException { StringBuilder sb = new StringBuilder(); sb.append("data:image/"); - if(ext.equalsIgnoreCase(ImageWorker.JPEG) || ext.equalsIgnoreCase(ImageWorker.JPG)) { - sb.append("jpeg"); - } else if(ext.equalsIgnoreCase(ImageWorker.PNG)) { - sb.append("png"); - } + //if(ext.equalsIgnoreCase(ImageWorker.JPEG) || ext.equalsIgnoreCase(ImageWorker.JPG)) { + // sb.append("jpeg"); + //} else if(ext.equalsIgnoreCase(ImageWorker.PNG)) { + // sb.append("png"); + //} + sb.append(ext.toLowerCase()); sb.append(";base64,"); byte[] buf = new byte[4096]; InputStream is = new FileInputStream(b64File); -- Gitblit v1.9.3