Coder Social home page Coder Social logo

image_gallery_saver's Introduction

image_gallery_saver

Build Status pub package license

We use the image_picker plugin to select images from the Android and iOS image library, but it can't save images to the gallery. This plugin can provide this feature.

Usage

To use this plugin, add image_gallery_saver as a dependency in your pubspec.yaml file. For example:

dependencies:
  image_gallery_saver: '^2.0.3'

iOS

Your project need create with swift. Add the following keys to your Info.plist file, located in /ios/Runner/Info.plist:

  • NSPhotoLibraryAddUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Additions Usage Description in the visual editor

Android

You need to ask for storage permission to save an image to the gallery. You can handle the storage permission using flutter_permission_handler. In Android version 10, Open the manifest file and add this line to your application tag

<application android:requestLegacyExternalStorage="true" .....>

Example

Saving an image from the internet, quality and name is option

  _saveLocalImage() async {
    RenderRepaintBoundary boundary =
        _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary;
    ui.Image image = await boundary.toImage();
    ByteData? byteData =
        await (image.toByteData(format: ui.ImageByteFormat.png));
    if (byteData != null) {
      final result =
          await ImageGallerySaver.saveImage(byteData.buffer.asUint8List());
      print(result);
    }
  }
  
  _saveNetworkImage() async {
    var response = await Dio().get(
        "https://ss0.baidu.com/94o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=a62e824376d98d1069d40a31113eb807/838ba61ea8d3fd1fc9c7b6853a4e251f94ca5f46.jpg",
        options: Options(responseType: ResponseType.bytes));
    final result = await ImageGallerySaver.saveImage(
        Uint8List.fromList(response.data),
        quality: 60,
        name: "hello");
    print(result);
  }

Saving file(ig: video/gif/others) from the internet

  _saveNetworkGifFile() async {
    var appDocDir = await getTemporaryDirectory();
    String savePath = appDocDir.path + "/temp.gif";
    String fileUrl =
        "https://hyjdoc.oss-cn-beijing.aliyuncs.com/hyj-doc-flutter-demo-run.gif";
    await Dio().download(fileUrl, savePath);
    final result =
        await ImageGallerySaver.saveFile(savePath, isReturnPathOfIOS: true);
    print(result);
  }

  _saveNetworkVideoFile() async {
    var appDocDir = await getTemporaryDirectory();
    String savePath = appDocDir.path + "/temp.mp4";
    String fileUrl =
        "https://s3.cn-north-1.amazonaws.com.cn/mtab.kezaihui.com/video/ForBiggerBlazes.mp4";
    await Dio().download(fileUrl, savePath, onReceiveProgress: (count, total) {
      print((count / total * 100).toStringAsFixed(0) + "%");
    });
    final result = await ImageGallerySaver.saveFile(savePath);
    print(result);
  }

image_gallery_saver's People

Contributors

allen0505 avatar bingbingbog avatar dvaldivia avatar ened avatar equweiyu avatar harithay avatar hemlockbane avatar hyjfine avatar kazumi007 avatar nicolas-landa avatar qiuxiang avatar woodwen avatar xqqlv avatar zhuyangyang-lingoace avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

image_gallery_saver's Issues

image_gallery_saver: ^1.2.2 error

E/flutter (13390): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The method 'findRenderObject' was called on null.
E/flutter (13390): Receiver: null
E/flutter (13390): Tried calling: findRenderObject()
E/flutter (13390): #0 ScreenshotController.capture. (package:screenshot/screenshot.dart:41:9)
E/flutter (13390):
E/flutter (13390): #1 new Future.delayed. (dart:async/future.dart:316:39)
E/flutter (13390): #2 _rootRun (dart:async/zone.dart:1120:38)
E/flutter (13390): #3 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (13390): #4 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter (13390): #5 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:963:23)
E/flutter (13390): #6 _rootRun (dart:async/zone.dart:1124:13)
E/flutter (13390): #7 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (13390): #8 _CustomZone.bindCallback. (dart:async/zone.dart:947:23)
E/flutter (13390): #9 Timer._createTimer. (dart:async-patch/timer_patch.dart:21:15)
E/flutter (13390): #10 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
E/flutter (13390): #11 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
E/flutter (13390): #12 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
E/flutter (13390):

使用 rawRgba 报错

java.lang.IllegalStateException: BitmapFactory.decodeByteArray(image,0,image.size) must not be null

Doesn't seem to run at all, with error about swift version

Using Flutter 1.7.8, MacOS and XCode fully up to date, getting the following error trying to use the library. Should this be something I need to set?

...
- image_gallery_saver does not specify a Swift version and none of the targets (Runner) integrating it
have the SWIFT_VERSION attribute set. Please contact the author or set the SWIFT_VERSION attribute in at
least one of the targets that integrate this pod.

/usr/local/Cellar/cocoapods/1.7.1/libexec/gems/cocoapods-1.7.1/lib/cocoapods/installer/xcode/target_validator
.rb:122:in `verify_swift_pods_swift_version'
/usr/local/Cellar/cocoapods/1.7.1/libexec/gems/cocoapods-1.7.1/lib/cocoapods/installer/xcode/target_validator
.rb:37:in `validate!'
/usr/local/Cellar/cocoapods/1.7.1/libexec/gems/cocoapods-1.7.1/lib/cocoapods/installer.rb:578:in
`validate_targets'
/usr/local/Cellar/cocoapods/1.7.1/libexec/gems/cocoapods-1.7.1/lib/cocoapods/installer.rb:158:in `install!'
/usr/local/Cellar/cocoapods/1.7.1/libexec/gems/cocoapods-1.7.1/lib/cocoapods/command/install.rb:51:in `run'
/usr/local/Cellar/cocoapods/1.7.1/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.7.1/libexec/gems/cocoapods-1.7.1/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.7.1/libexec/gems/cocoapods-1.7.1/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.7.1/libexec/bin/pod:22:in `load'
/usr/local/Cellar/cocoapods/1.7.1/libexec/bin/pod:22:in `<main>'

Saving from file path

Reading a file from local storage as a Uint8List, sending it to platform, then deserializing content from other side can take time (at least on Android).

Maybe giving an other method to save a file from its path could reduce that extra-processing time ?

Edit

I forked and implemented the Android method and it is a lot more performant now!

文件不存在

java.io.FileNotFoundException: /storage/emulated/0/sample/1552639455353.png (No such file or directory)

on iOS Simulator when saving image this is the error

=== BUILD TARGET image_gallery_saver OF PROJECT Pods WITH CONFIGURATION Debug ===

.pub-cache/hosted/pub.dartlang.org/image_gallery_saver-1.1.0/ios/Classes/ImageGallerySaverPlugin.m:2:9: fatal error: 'image_gallery_saver/image_gallery_saver-Swift.h' file not found
#import <image_gallery_saver/image_gallery_saver-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Getting a pod install error

Getting a pod install error, This is the output when running flutter run -v
very new to flutter and mobile development in general not sure how to solve this issue. Please advise thanks!

` [!] Unable to determine Swift version for the following pods:

           - `image_gallery_saver` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the
           `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

`

FileNotFoundException: /storage/emulated/0/M-Path/1555858813855.png (No such file or directory)

When I execute the following code:
ByteData bytes = await rootBundle.load('assets/logotemp3.png');
final result = await ImageGallerySaver.save(bytes.buffer.asUint8List());

I get the following Exception, and nothing is saved to my gallery:

W/System.err(24588): java.io.FileNotFoundException: /storage/emulated/0/M-Path/1555858813855.png (No such file or directory) W/System.err(24588): at java.io.FileOutputStream.open0(Native Method) W/System.err(24588): at java.io.FileOutputStream.open(FileOutputStream.java:287) W/System.err(24588): at java.io.FileOutputStream.<init>(FileOutputStream.java:223) W/System.err(24588): at java.io.FileOutputStream.<init>(FileOutputStream.java:171) W/System.err(24588): at com.example.imagegallerysaver.ImageGallerySaverPlugin.saveImageToGallery(ImageGallerySaverPlugin.kt:48) W/System.err(24588): at com.example.imagegallerysaver.ImageGallerySaverPlugin.onMethodCall(ImageGallerySaverPlugin.kt:32) W/System.err(24588): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:201) W/System.err(24588): at io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl.handleMessageFromDart(FlutterNativeView.java:188) W/System.err(24588): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:202) W/System.err(24588): at android.os.MessageQueue.nativePollOnce(Native Method) W/System.err(24588): at android.os.MessageQueue.next(MessageQueue.java:325) W/System.err(24588): at android.os.Looper.loop(Looper.java:142) W/System.err(24588): at android.app.ActivityThread.main(ActivityThread.java:6673) W/System.err(24588): at java.lang.reflect.Method.invoke(Native Method) W/System.err(24588): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) W/System.err(24588): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:769)

Flutter doctor -v
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17763.437], locale nl-BE)
• Flutter version 1.2.1 at C:\src\flutter\flutter
• Framework revision 8661d8aecd (9 weeks ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\u0084978\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.

[√] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 34.0.2
• Dart plugin version 183.5901
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] Connected device (1 available)
• moto g 6 plus • ZY32335VSQ • android-arm64 • Android 8.0.0 (API 26)

• No issues found!

Setting file name

How can I set a name for images? current saving names are like "1573725322960.png". I want to enter the file name.

save in anamed folder in gallery

Can I save the image or video in a named folder in the gallery instead of the default folder....and can I create a folder inside the default folder to save specific images or videos in each folder for instance?

set the `SWIFT_VERSION` attribute

Unable to determine Swift version for the following pods:

- `image_gallery_saver` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

How display Video from local storage to Gallary

This plugin works like charm for Network images/videos.
I managed to display local images in the gallery which was created by my flutter app.
I am not sure, how to display video in a gallery from local storage.

Here is my code for saving an image from the temp folder and display in the gallery.

                Uri myUri = Uri.parse(widget.imgPath);
                File originalImageFile = new File.fromUri(myUri);
                Uint8List bytes;
                await originalImageFile.readAsBytes().then((value) {
                  bytes = Uint8List.fromList(value);
                  print('reading of bytes is completed');
                }).catchError((onError) {
                  print('Exception Error while reading audio from path:' +
                      onError.toString());
                });
                final result = await ImageGallerySaver.saveImage(Uint8List.fromList(bytes));
                print(result);

Here is what I am doing for saving temp video to a specific directory.

              File originalVideoFile = File(widget.videoFile);
              Directory directory = await getExternalStorageDirectory();
              if(!Directory("${directory.path}/Downloaded Status/Videos").existsSync()){
                Directory("${directory.path}/Downloaded Status/Videos").createSync(recursive: true);
              }
              String path = directory.path;
              String curDate = DateTime.now().toString();
              String newFileName = "$path/Downloaded Status/Videos/VIDEO-$curDate.mp4";
              print(newFileName);
              await originalVideoFile.copy(newFileName);

but this video is not visible in Gallary.
I need some help to display this video in the gallery.
-Thanks.

flutter 1.12.15 编译apk时报错 Permission denied

在 flutter 1.10.14 版本中 ,编译没问题。
在 flutter 1.12.15 版本中
编译apk报错,具体日志

Flutter crash report; please file at https://github.com/flutter/flutter/issues.

command
flutter build apk --target-platform android-arm,android-arm64 --split-per-abi

exception
ProcessException: ProcessException: Permission denied
Command: /Users/mickeystone/flutter/.pub-cache/hosted/pub.dartlang.org/image_gallery_saver-1.2.2/android/gradlew -I=/Users/mickeystone/flutter/packages/flutter_tools/gradle/aar_init_script.gradle -Pflutter-root=/Users/mickeystone/flutter -Poutput-dir=/Users/mickeystone/wor/flutter_wtf/build/app -Pis-plugin=true -Ptarget-platform=android-arm,android-arm64,android-x64 assembleAarRelease

#0 _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:266:37)

#1 buildGradleAar (package:flutter_tools/src/android/gradle.dart:548:33)
#2 buildPluginsAsAar (package:flutter_tools/src/android/gradle.dart:711:13)

#3 buildGradleApp (package:flutter_tools/src/android/gradle.dart:257:11)
#4 buildGradleApp (package:flutter_tools/src/android/gradle.dart:415:19)

#5 _AndroidBuilderImpl.buildApk (package:flutter_tools/src/android/android_builder.dart:97:13)
#6 BuildApkCommand.runCommand (package:flutter_tools/src/commands/build_apk.dart:106:26)
#7 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:615:18)

#8 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:515:33)

#9 AppContext.run. (package:flutter_tools/src/base/context.dart:146:29)
#10 _rootRun (dart:async/zone.dart:1126:13)
#11 _CustomZone.run (dart:async/zone.dart:1023:19)
#12 _runZoned (dart:async/zone.dart:1518:10)
#13 runZoned (dart:async/zone.dart:1465:12)
#14 AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#15 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:505:20)
#16 CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#17 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:413:21)

#18 AppContext.run. (package:flutter_tools/src/base/context.dart:146:29)
#19 _rootRun (dart:async/zone.dart:1126:13)
#20 _CustomZone.run (dart:async/zone.dart:1023:19)
#21 _runZoned (dart:async/zone.dart:1518:10)
#22 runZoned (dart:async/zone.dart:1465:12)
#23 AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#24 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:19)
#25 CommandRunner.run. (package:args/command_runner.dart:112:25)
#26 new Future.sync (dart:async/future.dart:224:31)
#27 CommandRunner.run (package:args/command_runner.dart:112:14)
#28 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:250:18)
#29 run.. (package:flutter_tools/runner.dart:63:22)
#30 _rootRun (dart:async/zone.dart:1126:13)
#31 _CustomZone.run (dart:async/zone.dart:1023:19)
#32 _runZoned (dart:async/zone.dart:1518:10)
#33 runZoned (dart:async/zone.dart:1502:12)
#34 run. (package:flutter_tools/runner.dart:61:18)

#35 AppContext.run. (package:flutter_tools/src/base/context.dart:146:29)
#36 _rootRun (dart:async/zone.dart:1126:13)
#37 _CustomZone.run (dart:async/zone.dart:1023:19)
#38 _runZoned (dart:async/zone.dart:1518:10)
#39 runZoned (dart:async/zone.dart:1465:12)
#40 AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#41 runInContext (package:flutter_tools/src/context_runner.dart:64:24)
#42 run (package:flutter_tools/runner.dart:50:10)
#43 main (package:flutter_tools/executable.dart:65:9)
#44 main (file:///Users/mickeystone/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#45 _startIsolate. (dart:isolate-patch/isolate_patch.dart:305:32)
#46 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
flutter doctor
�[32m[✓]�[39m Flutter (Channel unknown, v1.12.14, on Mac OS X 10.15.1 19B88, locale zh-Hans-PH)
�[32m•�[39m Flutter version 1.12.14 at /Users/mickeystone/flutter
�[32m•�[39m Framework revision 7726910a5b (6 天前), 2019-11-25 16:47:51 -0500
�[32m•�[39m Engine revision c89ac6347b
�[32m•�[39m Dart version 2.7.0

�[32m[✓]�[39m Android toolchain - develop for Android devices (Android SDK version 29.0.2)
�[32m•�[39m Android SDK at /Users/mickeystone/Library/Android/sdk
�[32m•�[39m Android NDK location not configured (optional; useful for native profiling support)
�[32m•�[39m Platform android-29, build-tools 29.0.2
�[32m•�[39m Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
�[32m•�[39m Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
�[32m•�[39m All Android licenses accepted.

�[32m[✓]�[39m Xcode - develop for iOS and macOS (Xcode 11.2.1)
�[32m•�[39m Xcode at /Applications/Xcode.app/Contents/Developer
�[32m•�[39m Xcode 11.2.1, Build version 11B53
�[32m•�[39m CocoaPods version 1.8.4

�[32m[✓]�[39m Android Studio (version 3.5)
�[32m•�[39m Android Studio at /Applications/Android Studio.app/Contents
�[32m•�[39m Flutter plugin version 41.1.2
�[32m•�[39m Dart plugin version 191.8593
�[32m•�[39m Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

�[32m[✓]�[39m IntelliJ IDEA Ultimate Edition (version 2019.3)
�[32m•�[39m IntelliJ at /Users/mickeystone/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
�[32m•�[39m Flutter plugin version 41.1.5
�[32m•�[39m Dart plugin version 193.5432

�[33m[!]�[39m VS Code (version 1.40.1)
�[32m•�[39m VS Code at /Applications/Visual Studio Code.app/Contents
�[31m✗�[39m Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

�[32m[✓]�[39m Connected device (1 available)
�[32m•�[39m iPhone 8 • DD1B2F21-6F6A-474A-908A-3FA5D3EAE79D • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-2 (simulator)

�[33m!�[39m Doctor found issues in 1 category.

'image_gallery_saver/image_gallery_saver-Swift.h' file not found

image_gallery_saver/image_gallery_saver-Swift.h' file not found
#import <image_gallery_saver/image_gallery_saver-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Pods-Runner-dwokpppkepdbjiegihihefqywwom
note: Using new build systemnote: Planning buildnote: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone Xʀ.

Android build apk failed

Configure project :app
WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a
stack trace.

Configure project :image_gallery_saver
*********************************************************
WARNING: This version of connectivity will break your Android build if it or its dependencies aren't compatible with AndroidX.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************

java.io.FileNotFoundException: /storage/emulated/0/APP_NAME/1573113036325.png: open failed: ENOENT (No such file or directory)

W/System.err( 5899): at libcore.io.IoBridge.open(IoBridge.java:496)
W/System.err( 5899): at java.io.FileOutputStream.(FileOutputStream.java:235)
W/System.err( 5899): at java.io.FileOutputStream.(FileOutputStream.java:186)
W/System.err( 5899): at com.example.imagegallerysaver.ImageGallerySaverPlugin.saveImageToGallery(ImageGallerySaverPlugin.kt:61)
W/System.err( 5899): at com.example.imagegallerysaver.ImageGallerySaverPlugin.onMethodCall(ImageGallerySaverPlugin.kt:33)
W/System.err( 5899): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
W/System.err( 5899): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
W/System.err( 5899): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
W/System.err( 5899): at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err( 5899): at android.os.MessageQueue.next(MessageQueue.java:336)
W/System.err( 5899): at android.os.Looper.loop(Looper.java:180)
W/System.err( 5899): at android.app.ActivityThread.main(ActivityThread.java:7520)
W/System.err( 5899): at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 5899): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
W/System.err( 5899): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
W/System.err( 5899): Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
W/System.err( 5899): at libcore.io.Linux.open(Native Method)
W/System.err( 5899): at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
W/System.err( 5899): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
W/System.err( 5899): at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
W/System.err( 5899): at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7419)
W/System.err( 5899): at libcore.io.IoBridge.open(IoBridge.java:482)
W/System.err( 5899): ... 14 more`

kotlin.io.NoSuchFileException

Hi,

I'm using image_gallery_saver to save videos in my app. I get this error

kotlin.io.NoSuchFileException: /data/user/0/com.example.app/cache/record/f1759ee46913f0d844c6280f555d3125-1575211960680.mp4: The source file doesn't exist.

What am i missing?

Thanks,
Chethan

Kotlin Gradle plugin version 1.2.51

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'image_gallery_saver' is using version 1.2.30.

is best to return a path

Thanks to provider so cool plugin that we can save image to system gallery easyly.
hope to have a new feature as the code shown below.

final filePath= await ImageGallerySaver.save(byteData.buffer.asUint8List());
var savedFile = File.fromUri(Uri.file(filePath));

By the way, with the savedFile uri, we can share it .

Plugin crashing in JobScheduler because activity is null

registrar.activity() needs to be checked that it is not null, otherwise it crashes while being executed inside JobScheduler.

2019-10-30 17:50:54.159 16607-16607/? D/TSBackgroundFetch: 💀 [HeadlessTask]
2019-10-30 17:50:54.742 16607-16607/? E/JobServiceEngine: Error while executing job: 998
2019-10-30 17:50:54.742 16607-16607/? D/AndroidRuntime: Shutting down VM
2019-10-30 17:50:54.743 16607-16607/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example, PID: 16607
java.lang.RuntimeException: java.lang.IllegalStateException: registrar.activity() must not be null
at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:112)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7076)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Caused by: java.lang.IllegalStateException: registrar.activity() must not be null
at carnegietechnologies.gallery_saver.GallerySaverPlugin$Companion.registerWith(GallerySaverPlugin.kt:17)
at carnegietechnologies.gallery_saver.GallerySaverPlugin.registerWith(Unknown Source:2)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:28)
at com.example.Application.registerWith(Application.java:18)
at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.initFlutterView(HeadlessTask.java:133)
at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.(HeadlessTask.java:47)
at com.transistorsoft.flutter.backgroundfetch.HeadlessJobService.onStartJob(HeadlessJobService.java:38)
at android.app.job.JobService$1.onStartJob(JobService.java:62)
at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:108)
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:214) 
at android.app.ActivityThread.main(ActivityThread.java:7076) 

Remove hard coded path - image_gallery_saver

I am using this plugin and ran in to problem when using this with many of my different apps.

Since the location is hard-coded as "image_gallery_saver", I am unable to change the direectory where the image gets stored.

When using this in multiple apps, all images gets to a single folder.

Suggestion: Please take an argument or using the app name automatically.

No such file or directory errror, even though has storage permission

logs

W/System.err(10093): java.io.FileNotFoundException: /storage/emulated/0/xxx/1571468048334.png: open failed: ENOENT (No such file or directory)
W/System.err(10093):    at libcore.io.IoBridge.open(IoBridge.java:496)
W/System.err(10093):    at java.io.FileOutputStream.<init>(FileOutputStream.java:235)
W/System.err(10093):    at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
W/System.err(10093):    at com.example.imagegallerysaver.ImageGallerySaverPlugin.saveImageToGallery(ImageGallerySaverPlugin.kt:61)
W/System.err(10093):    at com.example.imagegallerysaver.ImageGallerySaverPlugin.onMethodCall(ImageGallerySaverPlugin.kt:33)
W/System.err(10093):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
W/System.err(10093):    at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
W/System.err(10093):    at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:645)
W/System.err(10093):    at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err(10093):    at android.os.MessageQueue.next(MessageQueue.java:336)
W/System.err(10093):    at android.os.Looper.loop(Looper.java:174)
W/System.err(10093):    at android.app.ActivityThread.main(ActivityThread.java:7356)
W/System.err(10093):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(10093):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
W/System.err(10093):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
W/System.err(10093): Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
W/System.err(10093):    at libcore.io.Linux.open(Native Method)
W/System.err(10093):    at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
W/System.err(10093):    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
W/System.err(10093):    at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
W/System.err(10093):    at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7255)
W/System.err(10093):    at libcore.io.IoBridge.open(IoBridge.java:482)
  • Already reinstalled the app
  • iOS performs well

AndroidManifest

...
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
...

可以不用swift吗

可以不用swift吗,听说用了swift,包会变大,而且开发过程中出现好多问题哦

push to dart pub, please

push to dart pub, please!

  • What went wrong:
    The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
    The following dependencies do not satisfy the required version:
    project ':image_gallery_saver' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51

提个建议

很多image库都不支持 指定 保存文件名称(包括后缀),建议我们这个库可以支持下

工程报错

Definition of 'ImageGallerySaverPlugin' must be imported from module 'image_gallery_saver.ImageGallerySaverPlugin' before it is requir

Does this work for video?

Does the plugin work for saving a video file? If so, can an example be given.

Apologies if this is duplicating another logged issue called "video". There seemed to be no detail in that issue.

Thank you,

Plugin takes too long to start

Hello, I am having some issues with the plugin. Please see below.

I/zygote64(17520): Background concurrent copying GC freed 790(149KB) AllocSpace objects, 0(0B) LOS objects, 50% free, 8MB/16MB, paused 5.227ms total 60.443ms
I/zygote64(17520): Thread[3,tid=17527,WaitingInMainSignalCatcherLoop,Thread*=0x75602c1400,peer=0x78a40298,"Signal Catcher"]: reacting to signal 3
I/zygote64(17520): 
I/zygote64(17520): Wrote stack traces to '/data/anr/traces.txt'
I/flutter (17520): EVENT StorageTaskEventType.progress
I/flutter (17520): EVENT StorageTaskEventType.progress
I/flutter (17520): EVENT StorageTaskEventType.progress
I/flutter (17520): EVENT StorageTaskEventType.success

I read somewhere that this error is related to how long the plugging is taking to start.

Image orientation change sometimes

Hi! Sometimes the images change the initial orientation. Is there a way to save or check the metadata of the images?
For example, in my flutter app I see a vertical orientation of an image, however when I save the image the orientation change to horizontal.

Save image error : No such file or directory

W/System.err( 6526): java.io.FileNotFoundException: /storage/emulated/0/jiupai/1558158842041.png (No such file or directory) W/System.err( 6526): at java.io.FileOutputStream.open0(Native Method) W/System.err( 6526): at java.io.FileOutputStream.open(FileOutputStream.java:308) W/System.err( 6526): at java.io.FileOutputStream.<init>(FileOutputStream.java:238) W/System.err( 6526): at java.io.FileOutputStream.<init>(FileOutputStream.java:180) W/System.err( 6526): at com.example.imagegallerysaver.ImageGallerySaverPlugin.saveImageToGallery(ImageGallerySaverPlugin.kt:48) W/System.err( 6526): at com.example.imagegallerysaver.ImageGallerySaverPlugin.onMethodCall(ImageGallerySaverPlugin.kt:32) W/System.err( 6526): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222) W/System.err( 6526): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:90) W/System.err( 6526): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:234) W/System.err( 6526): at android.os.MessageQueue.nativePollOnce(Native Method) W/System.err( 6526): at android.os.MessageQueue.next(MessageQueue.java:326) W/System.err( 6526): at android.os.Looper.loop(Looper.java:160) W/System.err( 6526): at android.app.ActivityThread.main(ActivityThread.java:6669) W/System.err( 6526): at java.lang.reflect.Method.invoke(Native Method) W/System.err( 6526): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) W/System.err( 6526): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.