| | |
| | |
|
| | | package de.uhilger.filecms.api;
|
| | |
|
| | | import de.uhilger.filecms.data.Bild;
|
| | | import java.awt.Container;
|
| | | import java.awt.Image;
|
| | | import java.awt.MediaTracker;
|
| | | import java.awt.Toolkit;
|
| | | import de.uhilger.wbx.Bild;
|
| | | import java.io.BufferedReader;
|
| | | import java.io.File;
|
| | | import java.io.FileFilter;
|
| | |
| | | import java.io.PrintWriter;
|
| | | import java.util.logging.Level;
|
| | | import java.util.logging.Logger;
|
| | | import net.coobird.thumbnailator.Thumbnails;
|
| | | import org.apache.commons.io.FileUtils;
|
| | |
|
| | | /**
|
| | |
| | | String line = br.readLine();
|
| | | while(line != null) {
|
| | | w.print(line.replace("htmi", "html"));
|
| | | w.print("\r\n");
|
| | | line = br.readLine();
|
| | | }
|
| | | printFooter(w);
|
| | |
| | | FileUtils.copyFile(stile, new File(outDir, "stile.css"), true);
|
| | | }
|
| | | buildThumbnailImages(outDir, new Bild());
|
| | | |
| | | File lbDir = new File(catalinaBase, "webapps/jslib/lightbox/");
|
| | | FileUtils.copyDirectoryToDirectory(lbDir, outDir);
|
| | | |
| | | File jqDir = new File(catalinaBase, "webapps/jslib/jquery/");
|
| | | FileUtils.copyDirectoryToDirectory(jqDir, outDir);
|
| | | |
| | | File lbimgDir = new File(catalinaBase, "webapps/jslib/lightbox/img");
|
| | | FileUtils.copyDirectoryToDirectory(lbimgDir, outDir);
|
| | | |
| | | |
| | | result = "Export nach HTML ausgefuehrt.";
|
| | | } catch (IOException ex) {
|
| | | result = ex.getLocalizedMessage();
|
| | |
| | | }
|
| | | String outFileName = new File(dir, tnFileName.toString()).getAbsolutePath();
|
| | | logger.fine("outFileName: " + outFileName);
|
| | | |
| | | try {
|
| | | Thumbnails.of(absPath)
|
| | | .size(bild.getVariantenGroesse(Bild.WINZIG), bild.getVariantenGroesse(Bild.WINZIG))
|
| | | .keepAspectRatio(true)
|
| | | .outputQuality(0.7)
|
| | | .toFile(outFileName);
|
| | | } catch (IOException ex) {
|
| | | logger.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
|
| | | }
|
| | | /*
|
| | | Image image = Toolkit.getDefaultToolkit().getImage(absPath);
|
| | | MediaTracker mediaTracker = new MediaTracker(new Container());
|
| | | mediaTracker.addImage(image, 0);
|
| | |
| | | }
|
| | | } catch (InterruptedException | IOException ex) {
|
| | | logger.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
|
| | | } |
| | | } |
| | | */
|
| | | }
|
| | | }
|
| | | } else {
|
| | |
| | | out.print("<!DOCTYPE html><html><head>\r\n");
|
| | | out.print("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>");
|
| | | out.print("<link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap.min.css\">\r\n");
|
| | | out.print("<link rel=\"stylesheet\" type=\"text/css\" href=\"lightbox/lightbox.css\">\r\n");
|
| | | out.print("<link rel=\"stylesheet\" type=\"text/css\" href=\"stile.css\">\r\n");
|
| | | out.print("</head><body class=\"p-3\">\r\n");
|
| | | }
|
| | |
|
| | | private void printFooter(PrintWriter out) throws IOException {
|
| | | out.print("<script src=\"jquery/jquery.min.js\"></script>\r\n");
|
| | | out.print("<script src=\"lightbox/lightbox.min.js\"></script>\r\n");
|
| | | out.print("</body></html>");
|
| | | }
|
| | |
|