From e06bc945b7f0cffa0cf2ee9e26440ba5f6e7b461 Mon Sep 17 00:00:00 2001 From: Ognjen Cirkovic Date: Sun, 27 Nov 2022 15:43:25 +0100 Subject: Ukoliko postoji kompresovana slika on je samo vraca , ukoliko ne upisuje je na fajl sistem i vraca bytearray. Dodati pozivi za preuzimanje kompresovanih slika na clientu. --- Backend/Api/Api/Services/FileService.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Backend') diff --git a/Backend/Api/Api/Services/FileService.cs b/Backend/Api/Api/Services/FileService.cs index b951efc..440b24f 100644 --- a/Backend/Api/Api/Services/FileService.cs +++ b/Backend/Api/Api/Services/FileService.cs @@ -31,11 +31,14 @@ namespace Api.Services Models.File f = await getById(id); if (f == null || !System.IO.File.Exists(f.path)) return res; + if (System.IO.File.Exists(f.path + "-compress")) + return System.IO.File.ReadAllBytes(f.path + "-compress"); using (MagickImage image = new MagickImage(f.path)) { image.Format = image.Format; image.Quality = 30; res= image.ToByteArray(); + image.Write(f.path + "-compress"); } -- cgit v1.2.3