Coder Social home page Coder Social logo

samoy / image_save Goto Github PK

View Code? Open in Web Editor NEW
22.0 22.0 27.0 514 KB

Save image to album or sandbox

Home Page: https://pub.dev/packages/image_save

License: MIT License

Java 38.58% Ruby 7.08% Objective-C 28.64% Dart 25.71%
dart flutter flutter-plugin image image-save

image_save's Introduction

image_save's People

Contributors

samoy avatar xalanq avatar

Stargazers

 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

image_save's Issues

File path adapt for new Android version

Currently image file will be saved at /stroage/emulated/0/{album_name}/IMAGE_$timestamp.$extension. But according to new rules about the storage, the file might be saved at /storage/emulated/0/Android/data/xxx.xxxxxx.xx/files/{album_name}/IMAGE_$timestamp.$extension.

Also, is there possible to expose image name parameter for custom image name? e.g. I want the image filename as same as it was before.

Sorry, 没注意到是国人^_^
可否以新方式存储在对应的文件夹中?另外是否能暴露设置文件名的参数?

Unhandled Exception: MissingPluginException(No implementation found for method saveImage on channel image_save

this is my problem,I am using your example on the pub
E/flutter ( 8461): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method saveImage on channel image_save)
E/flutter ( 8461): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)
E/flutter ( 8461):
E/flutter ( 8461): #1 ImageSave.saveImage (package:image_save/image_save.dart:10:40)
E/flutter ( 8461): #2 _MyAppState._saveImage (package:flutterapp/main.dart:33:23)
E/flutter ( 8461):
E/flutter ( 8461): #3 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)

Path to saved file

If I save the image to sandbox (ImageSave.saveImageToSandbox(_data, "file.jpeg"), what is the path to this file ?
Many thanks.

Can not save image

Android
await ImageSave.saveImage("gif", Uint8List.fromList(_gif));
Error:
java.io.FileNotFoundException: /storage/emulated/0/测试APP/IMAGE_1571584085719.gif (No such file or directory)

the path not looks like not album path...
App name: "测试APP"

iOS端图片保存异常

一张png的图片,安卓上保存正常,但是iOS端(系统版本 13.5)抛出异常 PlatformException(-1, Error Domain=PHPhotosErrorDomain Code=-1 "(null)", null)
搜索了一下,可能和图片格式有关https://stackoverflow.com/questions/28348450/phphotolibrary-error-while-saving-image-at-url
但是我使用saveImage方法时,尝试过保存不同的格式“png”“jpg”都一样出错。而saveImageToSandbox不报异常,但是保存后在相册里找不到该图片。

Flutter 1.17.2

保存源生组件时出错

[VERBOSE-2:platform_view_layer.cc(22)] Trying to embed a platform view but the PrerollContext does not support embedding
[VERBOSE-2:platform_view_layer.cc(39)] Trying to embed a platform view but the PaintContext does not support embedding

为啥我用的时候报不兼容AndroidX

D:\SDK\flutter.pub-cache\hosted\pub.dartlang.org\image_save-1.1.3\android\src\main\java\com\samoy\image_save\ImageSavePlugin.java:9: ����: �����android.support.annotation������
import android.support.annotation.NonNull;
^
D:\SDK\flutter.pub-cache\hosted\pub.dartlang.org\image_save-1.1.3\android\src\main\java\com\samoy\image_save\ImageSavePlugin.java:41: ����: �Ҳ�������
public void onMethodCall(MethodCall call,@nonnull Result result) {
^
����: �� NonNull
�: �� ImageSavePlugin
2 ������

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':image_save:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 13s


The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.


Finished with error: Gradle task assembleDebug failed with exit code 1

Permission for API 34

What permission do we need to save images on Android with this package for API 34?
Tried such options

  • READ_MEDIA_IMAGES
  • READ_MEDIA_VIDEO
  • READ_MEDIA_AUDIO
  • MANAGE_EXTERNAL_STORAGE

according to documentation https://pub.dev/packages/permission_handler FAQ, but no luck.

Code sample

Future<bool> save(String filename, Uint8List data) async {
  final ok = await ImageSave.saveImage(data, filename, albumName: 'someAlbum');
  return ok ?? false;
}

安卓10保存图片失败

在荣耀9(安卓9)上保存图片没问题
在realme x7 pro(安卓10)上保存图片失败
存储权限都确认给了
报错情况如下:
W/System.err( 5536): java.io.FileNotFoundException: /storage/emulated/0/Pictures/Lugoby/IMG_20210119_132512_767073.jpg: open failed: EACCES (Permission denied)
W/System.err( 5536): at libcore.io.IoBridge.open(IoBridge.java:538)
W/System.err( 5536): at java.io.FileOutputStream.(FileOutputStream.java:235)
W/System.err( 5536): at java.io.FileOutputStream.(FileOutputStream.java:186)
W/System.err( 5536): at com.samoy.image_save.ImageSavePlugin.saveImage(ImageSavePlugin.java:109)
W/System.err( 5536): at com.samoy.image_save.ImageSavePlugin.saveImageCall(ImageSavePlugin.java:88)
W/System.err( 5536): at com.samoy.image_save.ImageSavePlugin.methodCall(ImageSavePlugin.java:68)
W/System.err( 5536): at com.samoy.image_save.ImageSavePlugin.onMethodCall(ImageSavePlugin.java:58)
W/System.err( 5536): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
W/System.err( 5536): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
W/System.err( 5536): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
W/System.err( 5536): at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err( 5536): at android.os.MessageQueue.next(MessageQueue.java:336)
W/System.err( 5536): at android.os.Looper.loop(Looper.java:184)
W/System.err( 5536): at android.app.ActivityThread.main(ActivityThread.java:7878)
W/System.err( 5536): at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 5536): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:512)
W/System.err( 5536): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028)
W/System.err( 5536): Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
W/System.err( 5536): at libcore.io.Linux.open(Native Method)
W/System.err( 5536): at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
W/System.err( 5536): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
W/System.err( 5536): at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
W/System.err( 5536): at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7768)
W/System.err( 5536): at libcore.io.IoBridge.open(IoBridge.java:524)
W/System.err( 5536): ... 16 more

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.