mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-23 00:40:59 +00:00
Fix image max size in app extension
This commit is contained in:
parent
6f484fa6c5
commit
8b4f6dbd05
1 changed files with 9 additions and 2 deletions
|
@ -15,11 +15,18 @@ actor StatusEditorCompressor {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let maxPixelSize: Int
|
||||||
|
if Bundle.main.bundlePath.hasSuffix(".appex") {
|
||||||
|
maxPixelSize = 1536
|
||||||
|
} else {
|
||||||
|
maxPixelSize = 4096
|
||||||
|
}
|
||||||
|
|
||||||
let downsampleOptions = [
|
let downsampleOptions = [
|
||||||
kCGImageSourceCreateThumbnailFromImageAlways: true,
|
kCGImageSourceCreateThumbnailFromImageAlways: true,
|
||||||
kCGImageSourceCreateThumbnailWithTransform: true,
|
kCGImageSourceCreateThumbnailWithTransform: true,
|
||||||
kCGImageSourceThumbnailMaxPixelSize: 4096,
|
kCGImageSourceThumbnailMaxPixelSize: maxPixelSize,
|
||||||
] as CFDictionary
|
] as [CFString : Any] as CFDictionary
|
||||||
|
|
||||||
guard let cgImage = CGImageSourceCreateThumbnailAtIndex(source, 0, downsampleOptions) else {
|
guard let cgImage = CGImageSourceCreateThumbnailAtIndex(source, 0, downsampleOptions) else {
|
||||||
continuation.resume(returning: nil)
|
continuation.resume(returning: nil)
|
||||||
|
|
Loading…
Reference in a new issue