File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ Future<File> compressImage(File file,
5858 return file;
5959}
6060
61+ // Deprecated
6162Future <List <XFile >?> onPickFiles () async {
6263 try {
6364 FilePicker .platform.clearTemporaryFiles ();
@@ -110,6 +111,14 @@ Future<List<XFile>?> onPickImages() async {
110111 imageQuality: (Preferences .getUploadQuality * 100 ).round (),
111112 requestFullMetadata: ! Preferences .getRemoveMetadata,
112113 );
114+ for (var file in files) {
115+ if (file.name.endsWith ('.heic' )) {
116+ String ? jpgPath = await HeicToJpg .convert (file.path);
117+ if (jpgPath != null ) {
118+ files[files.indexWhere ((f) => f == file)] = XFile (jpgPath);
119+ }
120+ }
121+ }
113122 return files;
114123 } catch (e) {
115124 debugPrint ('${e .toString ()}' );
@@ -132,6 +141,12 @@ Future<XFile?> onTakePhoto(BuildContext context) async {
132141 imageQuality: (Preferences .getUploadQuality * 100 ).round (),
133142 requestFullMetadata: ! Preferences .getRemoveMetadata,
134143 );
144+ if (image != null ) {
145+ String ? jpgPath = await HeicToJpg .convert (image.path);
146+ if (jpgPath != null ) {
147+ image = XFile (jpgPath);
148+ }
149+ }
135150 break ;
136151 case 1 :
137152 image = await _picker.pickVideo (source: ImageSource .camera);
You can’t perform that action at this time.
0 commit comments