From dc60c57e50da7a462a0f87abc8ead68b19b8063e Mon Sep 17 00:00:00 2001
From: Mustafa Merza <mustafa.merza95@gmail.com>
Date: Sun, 11 Aug 2024 14:27:28 +0300
Subject: [PATCH] - Added compressing images when saved.

---
 .../Frameworks/CustomWeScan/Extensions/URL+Utils.swift      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/MiniScanner/Supporting Files/Frameworks/CustomWeScan/Extensions/URL+Utils.swift b/MiniScanner/Supporting Files/Frameworks/CustomWeScan/Extensions/URL+Utils.swift
index a995990..81cab1f 100644
--- a/MiniScanner/Supporting Files/Frameworks/CustomWeScan/Extensions/URL+Utils.swift	
+++ b/MiniScanner/Supporting Files/Frameworks/CustomWeScan/Extensions/URL+Utils.swift	
@@ -10,8 +10,12 @@ import Foundation
 import UIKit
 
 extension URL {
+    
     func saveImage(image: UIImage?) -> URL? {
-        if let jpgRepresentation = image?.jpegData(compressionQuality: 1.0) {
+        
+        if let image: UIImage = image?.wxCompress(),
+           let jpgRepresentation = image.jpegData(compressionQuality: 1.0) {
+            
             do  {
                 try jpgRepresentation.write(to: self,
                                             options: .atomic)
-- 
GitLab