fluttercandies / saver_gallery

MIT License
15 stars 15 forks source link

Saving gif on iOS #2

Closed RoyalCoder88 closed 1 year ago

RoyalCoder88 commented 1 year ago

Hi @zhangruiyu ,

Thanks for your great package, my problem is with saving in gallery a gif file on iOS, on Android it works like a charm, but on iOS saving as an image or saving as file always a gif file is saved as a jpeg, I tried a lot of things, can make it work :( can you please guide me on how to achieve this please?

Thanks in advance!

zhangruiyu commented 1 year ago

you can try SaverGallery.saveFile. If you still can't save successfully, please reply me, I will try to repair tomorrow

RoyalCoder88 commented 1 year ago

Hi @zhangruiyu ,

Thanks a lot, I tested as well with saveImage:

      var appDocDir = await getTemporaryDirectory();
      String savePath =
          "${appDocDir.path}/MyApp_gif_${Timestamp.now().millisecondsSinceEpoch}.gif";

await Dio().download(fileUrl, savePath).whenComplete(() async {
        await SaverGallery.saveFile(savePath, isReturnPathOfIOS: false)
            .whenComplete(
          () {
            showMsg(msgOnSaved);
            print('Gif saved: $savePath');
          },
        );
      });```

also **saveFile**:
   var response = await Dio()
      .get(fileUrl, options: Options(responseType: ResponseType.bytes));
   String picturesPath = "Pictures/MyApp/test.gif";
   debugPrint(picturesPath);
   final result =
       await SaverGallery.saveImage(Uint8List.fromList(response.data),
          //quality: 100,
          fileExtension: 'gif',
          name: picturesPath,
           androidRelativePath: "Pictures/MyApp/test_1.gif");
   print(result);

To mention, the images are downloaded from Firebase Storage, so the **fileUrl** is:  

https://firebasestorage.googleapis.com/v0/b/unipeople-app.appspot.com/o/FCMImages%2Fgif_test.gif?alt=media&token=f8997e4e-1226-4cff-9907-5fb8ecf5edbc



Thanks again for your great support! 
Happy coding!
zhangruiyu commented 1 year ago

version 1.0.8 has been released and can be updated to try and fix the problem use SaverGallery.saveImage

RoyalCoder88 commented 1 year ago

Thanks a lot @zhangruiyu now it works perfectly ;) keep up the good work!