ericnograles / browser-image-resizer

A tiny browser-based library to downscale and/or resize images using canvas
MIT License
98 stars 42 forks source link

Doesn't work on Wkwbview #39

Open Aarbel opened 3 years ago

Aarbel commented 3 years ago

This library doesn't seem to work on wkwebview (capacitor / cordova / ionic app).

Debug doesn't throw any log / error when passing a file to resizeAndCompressImage

Maybe you use APIs not available on wkwebview

Do you plan to fix it ?

ericnograles commented 3 years ago

@Aarbel looks like WKWebView has some specific, platform-level limitations: https://cordova.apache.org/news/2018/08/01/future-cordova-ios-webview.html

Checking those issues, quite a few have been closed but there must be something we're doing in code that runs afoul of its limitations.

I unfortunately don't have time to research but would very much welcome a PR if you hunt it down.

Aarbel commented 3 years ago

@ericnograles

Logs like that in chrome, but dosn't work and blocks the code on wkwebview: image

image

Aarbel commented 3 years ago

If also posted a request on capacitor repo: cf https://github.com/ionic-team/capacitor/discussions/4389

Would be awesome for hybrid devices to compress images client side

ericnograles commented 3 years ago

Interesting -- if it's blocking the code on the WebView, perhaps there's something with either the callbacks or promise resolution that WKWebView doesn't like.

ericnograles commented 3 years ago

FWIW, for hybrid apps, it sorta feels like Cordova should have a mechanism to do that for you using either iOS or Java code since it'll probably be more battery and CPU efficient handling binaries, so that's a good feature request.

Aarbel commented 3 years ago

Yes, native handler would be much better