Upload photos taken from UIImagePickerController as JPEGs instead of PNGs
This commit is contained in:
parent
45ac40b125
commit
744329dca2
|
@ -51,7 +51,10 @@ enum CompositionAttachmentData {
|
|||
func getData(completion: @escaping (_ data: Data, _ mimeType: String) -> Void) {
|
||||
switch self {
|
||||
case let .image(image):
|
||||
completion(image.pngData()!, "image/png")
|
||||
// Export as JPEG instead of PNG, otherweise photos straight from the camera are too large
|
||||
// for Mastodon in its default configuration (max of 10MB).
|
||||
// The quality of 0.8 was chosen completely arbitrarily, it may need to be tuned in the future.
|
||||
completion(image.jpegData(compressionQuality: 0.8)!, "image/jpeg")
|
||||
case let .asset(asset):
|
||||
if asset.mediaType == .image {
|
||||
let options = PHImageRequestOptions()
|
||||
|
|
Loading…
Reference in New Issue