Resize picture / javscript

Hi, i’m trying to resize picture on upload, as they are taking too much space in google storage.
Option 1:
I have tried to use the plugin resize/compress image, but it’s not working (with a non clear error message : Unknown error occurred while resizing/compressing the image). i am sending a proper path, image works fine in the page, and i am using the same image path in the plugin.

Option 2:
I have looked into it, and found that i could use the “canvas” HTML element to do this size management in a javascript, but the code does not work, i need to do a [const canvas = document.createElement(“canvas”) ], but seems like i cannot access document, like if it was loaded after the script is run. i tried the wait onloaded, but still, does not work.

would you please have an idea of what i could do ? that wouild be very grateful !
thank you so much


What platform are you using? The resize/compress image does not work in web (it gives unknown error but the error code says platformNotSupported – the error should definitely be improved), but it should work on mobile :thinking: We are using react-native-image-resizer which only supports Android and iOS, but I’ll look into finding a plugin that would also support web for when we’re doing improvements to our plugins :thinking: (You would also be able to choose a react native plugin to your liking once third party plugin support is publicly available)

And yeahhh document is not available, our platform is React Native, not pure HTML :sweat_smile:

Other than that I don’t know I’m afraid :disappointed_relieved: Sorry I couldn’t be of more help!

hi, thanks for the feedback ! i am using web, haven’t tried in app, so couldn’t confirm.ok so i will wait for your update then ! i guess i could do an if to resize or not, and once the plugin is repaired, it would work on web too.
thanks again for taking the time, Sir Loki

1 Like