Code Monkey home page Code Monkey logo

Comments (14)

twainyoung avatar twainyoung commented on August 14, 2024

i met the same issue recently, which is wired , if i get image from camera ,the" resizeImage" function works fine , if i choose image from PHOTOLIBRARY, app crash.

from cordova-plugin-image-resizer.

srameshr avatar srameshr commented on August 14, 2024

Same here. Damn it. It works fine on IOS but not on Android! Here are the crash logs.

E/AndroidRuntime( 4183): FATAL EXCEPTION: pool-1-thread-2
E/AndroidRuntime( 4183): Process: com.myapp.android, PID: 4183
E/AndroidRuntime( 4183): java.lang.IllegalArgumentException: Found query in URI: file:///storage/emulated/0/Android/data/com.myapp.android/cache/IMG_20161120_204314.jpg?1479654794267
E/AndroidRuntime( 4183):    at java.io.File.checkURI(File.java:235)
E/AndroidRuntime( 4183):    at java.io.File.<init>(File.java:177)
E/AndroidRuntime( 4183):    at com.raananw.ImageResizePlugin$ImageTools.getBitmap(ImageResizePlugin.java:102)
E/AndroidRuntime( 4183):    at com.raananw.ImageResizePlugin$ResizeImage.run(ImageResizePlugin.java:197)
E/AndroidRuntime( 4183):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime( 4183):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime( 4183):    at java.lang.Thread.run(Thread.java:841)
E/Sensors (  822): Lightsensor values:49.000000
E/android.os.Debug(  822): !@Dumpstate > sdumpstate -k -t -z -d -o /data/log/dumpstate_app_error
E/Sensors (  822): Lightsensor values:49.000000
E/libEGL  ( 4183): call to OpenGL ES API with no current context (logged once per thread)

Will this ever be resolved, seeing that there is no activity on the repo. :(

from cordova-plugin-image-resizer.

JoschkaSchulz avatar JoschkaSchulz commented on August 14, 2024

I get all the new messages but haven't enough time to fix the stuff... if someone would like to write a bugfix and creates a pull request I will check and merge it.

from cordova-plugin-image-resizer.

srameshr avatar srameshr commented on August 14, 2024

@JoschkaSchulz I have no idea about objective c or java. Could you please fix this? Lots of people are dependent on this.

from cordova-plugin-image-resizer.

salzig avatar salzig commented on August 14, 2024

@srameshr

Found query in URI: file:///storage/emulated/0/Android/data/com.myapp.android/cache/IMG_20161120_204314.jpg?1479654794267

maybe call it without query string then?

btw, maybe i'm wrong, but you're not using the plugin provided by this repository (com.raananw.ImageResizePlugin vs. info.protonet.imageresizer.ImageResizer). Maybe you should call the author of com.raananw.ImageResizePlugin for action.

from cordova-plugin-image-resizer.

srameshr avatar srameshr commented on August 14, 2024

Both these repositories are similar. I have tried it with both the plugins. It throws the same error.
Could you elaborate on what do you mean by "without query"? Do you mean to just remove ?1479654794267 ? Or something else?

BTW, I am not appending any query to the path. It is what Cordova camera plugin provides by default.

May be I will check the path that is provided by camera and gallery and I will update

@salzig

from cordova-plugin-image-resizer.

srameshr avatar srameshr commented on August 14, 2024

@salzig OMG!!! It was due to the query string. I removed query string and it worked! 👍

If anyone comes here, please look at this. Here is the solution:

Here is the file path that is provided by Cordova when an image is chosen by gallery:

file:///storage/emulated/0/Android/data/com.app.ios/cache/IMG_20161122_124728.jpg?1083017394

You got to remove the query string ?1083017394 else, your app will crash.

var imagePath = file:///storage/emulated/0/Android/data/com.app.ios/cache/IMG_20161122_124728.jpg?1083017394;

if(imagePath.indexOf("?") > 0) {
  imagePath = imagePath.trim().split("?")[0];
}

And then provide this imagePath to the window.imageResizer.resizeImage function.

@JoschkaSchulz

from cordova-plugin-image-resizer.

littldr avatar littldr commented on August 14, 2024

@srameshr have you even tried this plugin? info.protonet.imageresizer.ImageResizer (They are similar, but not the same)

As I can see, this exception only happens in RaananW/PhoneGap-Image-Resizer/.../ImageResizePlugin.java#L102 cause their are not using FileHelper.getInputStreamFromUriString provided here: org.apache.cordova.camera.FileHelper (with the same 'remove query'-hack used internally).

This helper is used in this repo (see: ImageResizer.java#L95. So your issue should not happen with this plugin.

from cordova-plugin-image-resizer.

srameshr avatar srameshr commented on August 14, 2024

@Landreas

Then why are people who are using this plugin seems to be raising the same issue. As in this thread.

from cordova-plugin-image-resizer.

littldr avatar littldr commented on August 14, 2024

I'm not sure if this is the same issue like yours. Maybe @eliaweiss could provide a stracktrace?

from cordova-plugin-image-resizer.

srameshr avatar srameshr commented on August 14, 2024

@LAandreas

Either way, the plugin fails when you try to upload an image from gallery.

from cordova-plugin-image-resizer.

salzig avatar salzig commented on August 14, 2024

@srameshr thats guessing, not knowing. Your problem happens cause of a different source code.

would be cool if @eliaweiss or @twainyoung could provide a stacktrace.

from cordova-plugin-image-resizer.

JoschkaSchulz avatar JoschkaSchulz commented on August 14, 2024

Would like to see a Stack trace for that Project, then I can maybe invest some time to write a fix.

from cordova-plugin-image-resizer.

srameshr avatar srameshr commented on August 14, 2024

@salzig True. PS: @eliaweiss @twainyoung

from cordova-plugin-image-resizer.

Related Issues (20)

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.