Fix image max size in app extension
This commit is contained in:
parent
6f484fa6c5
commit
8b4f6dbd05
|
@ -15,11 +15,18 @@ actor StatusEditorCompressor {
|
|||
return
|
||||
}
|
||||
|
||||
let maxPixelSize: Int
|
||||
if Bundle.main.bundlePath.hasSuffix(".appex") {
|
||||
maxPixelSize = 1536
|
||||
} else {
|
||||
maxPixelSize = 4096
|
||||
}
|
||||
|
||||
let downsampleOptions = [
|
||||
kCGImageSourceCreateThumbnailFromImageAlways: true,
|
||||
kCGImageSourceCreateThumbnailWithTransform: true,
|
||||
kCGImageSourceThumbnailMaxPixelSize: 4096,
|
||||
] as CFDictionary
|
||||
kCGImageSourceThumbnailMaxPixelSize: maxPixelSize,
|
||||
] as [CFString : Any] as CFDictionary
|
||||
|
||||
guard let cgImage = CGImageSourceCreateThumbnailAtIndex(source, 0, downsampleOptions) else {
|
||||
continuation.resume(returning: nil)
|
||||
|
|
Loading…
Reference in New Issue