diff --git a/Caps/Data/Database.swift b/Caps/Data/Database.swift index a26b692..dea54d2 100644 --- a/Caps/Data/Database.swift +++ b/Caps/Data/Database.swift @@ -5,8 +5,6 @@ import CryptoKit final class Database: ObservableObject { - private let imageCompressionQuality: CGFloat = 0.3 - @AppStorage("classifier") private var storedLocalClassifierVersion = 0 { didSet { localClassifierVersion = storedLocalClassifierVersion } diff --git a/Caps/Data/ImageCache.swift b/Caps/Data/ImageCache.swift index f68cdb1..7a8f833 100644 --- a/Caps/Data/ImageCache.swift +++ b/Caps/Data/ImageCache.swift @@ -17,6 +17,8 @@ final class ImageCache: ObservableObject { private let imageQuality: CGFloat = 0.3 + private let imageSize: CGSize = .init(width: 360, height: 360) + @Published private(set) var imageCount = 0 @@ -41,7 +43,7 @@ final class ImageCache: ObservableObject { @discardableResult func save(_ image: UIImage, for cap: CapImage) -> Bool { - guard let data = image.jpegData(compressionQuality: imageQuality) else { + guard let data = image.resize(to: imageSize).jpegData(compressionQuality: imageQuality) else { return false } let localUrl = localImageUrl(cap)