Prevent re-downloading file if it's locally available on the server.

master
Joshua Sigona 4 years ago
parent cd83f7270c
commit f276a783c1
  1. BIN
      files/Blackjack.jpg
  2. BIN
      files/DECORATOR_EXplay_436_100_1_0_6_93.52.png
  3. BIN
      files/img.jpg
  4. BIN
      files/img0.jpg
  5. BIN
      files/img1.jpg
  6. BIN
      files/img10.png
  7. BIN
      files/img2.png
  8. BIN
      files/img3.png
  9. BIN
      files/img4.png
  10. BIN
      files/img5.png
  11. BIN
      files/img6.png
  12. BIN
      files/img7.png
  13. BIN
      files/img8.png
  14. BIN
      files/img9.png
  15. BIN
      files/plays/test
  16. 12
      src/main/java/com/example/demo/Controller.java

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

@ -134,9 +134,15 @@ public class Controller {
//System.out.println(body);
try {
System.out.println(url);
downloadFileFromUrl(url,"temp");
//BufferedImage img = ImageUtils.toBufferedImage(ImageIO.read(new File("temp")).getScaledInstance(1227, 690, Image.SCALE_SMOOTH));
BufferedImage img = ImageIO.read(new File("temp"));
BufferedImage img = null;
if (url.contains("http://projectdivar.com/files/")) {
//System.out.println("Locally available.");
img = ImageIO.read(new File("files",url.replace("http://projectdivar.com/files/", "")));
} else {
downloadFileFromUrl(url,"temp");
//BufferedImage img = ImageUtils.toBufferedImage(ImageIO.read(new File("temp")).getScaledInstance(1227, 690, Image.SCALE_SMOOTH));
img = ImageIO.read(new File("temp"));
}
if (img.getWidth()!=1200) {
//Resize.
img = ImageUtils.toBufferedImage(ImageIO.read(new File("temp")).getScaledInstance(1200, 675, Image.SCALE_SMOOTH));

Loading…
Cancel
Save