Fix filename not being tied to remote/local locations properly

master
Joshua Sigona 4 years ago
parent 1c48e04829
commit c23231e281
  1. 9
      src/main/java/com/example/demo/Controller.java

@ -135,18 +135,21 @@ public class Controller {
//System.out.println(body); //System.out.println(body);
try { try {
System.out.println(url); System.out.println(url);
File f;
BufferedImage img = null; BufferedImage img = null;
if (url.contains("http://projectdivar.com/")) { if (url.contains("http://projectdivar.com/")) {
//System.out.println("Locally available. "+"./"+url.replace("http://projectdivar.com/", "")); //System.out.println("Locally available. "+"./"+url.replace("http://projectdivar.com/", ""));
img = ImageIO.read(new File("../../server/"+url.replace("http://projectdivar.com/", ""))); f = new File("../../server/"+url.replace("http://projectdivar.com/", ""));
img = ImageIO.read(f);
} else { } else {
downloadFileFromUrl(url,"temp"); downloadFileFromUrl(url,"temp");
//BufferedImage img = ImageUtils.toBufferedImage(ImageIO.read(new File("temp")).getScaledInstance(1227, 690, Image.SCALE_SMOOTH)); //BufferedImage img = ImageUtils.toBufferedImage(ImageIO.read(new File("temp")).getScaledInstance(1227, 690, Image.SCALE_SMOOTH));
img = ImageIO.read(new File("temp")); f = new File("temp");
img = ImageIO.read(f);
} }
if (img.getWidth()!=1200) { if (img.getWidth()!=1200) {
//Resize. //Resize.
img = ImageUtils.toBufferedImage(ImageIO.read(new File("temp")).getScaledInstance(1200, 675, Image.SCALE_SMOOTH)); img = ImageUtils.toBufferedImage(ImageIO.read(f).getScaledInstance(1200, 675, Image.SCALE_SMOOTH));
} }
Point offset = new Point(418,204); Point offset = new Point(418,204);
File tmp = new File("tmp"); File tmp = new File("tmp");

Loading…
Cancel
Save