-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image can't resize, it is compress #604
Comments
what image size do you get in a response? |
image size ~70-100kb, dimensions is same source image |
react-native-image-crop-picker v0.20.0 Also seeing this issue where |
Hi, |
Also have this issue, not tested on ios but on android compressImageMaxWidth and compressImageMaxHeight is not respected. |
Same issue here. @ivpusic Shouldn't issues like this be super high on the priority list considering they're listed in the readme as options and don't actually work? Edit: FYI this is android only. Works on iOS. |
Update the implementation of image uploading in ComposeMenu.js We adopt react-native-image-crop-picker in favor of the old library (react-native-image-picker). This gives us the additional ability to downsample and downscale images before uploading them and also allows selecting multiple images in the same selection ( iOS only for now ). These changes will be implemented in a following commit. Currently, there is a bug in the image picker which results in the max width and height to only be applied on android. This is still an improvement over the previous library but will need to be kept in mind so when that bug is fixed we can upgrade. See ivpusic/react-native-image-crop-picker#604
stumbled upon the same. android doesn't work. |
Update the implementation of image uploading in ComposeMenu.js We adopt react-native-image-crop-picker in favor of the old library (react-native-image-picker). This gives us the additional ability to downsample and downscale images before uploading them and also allows selecting multiple images in the same selection ( iOS only for now ). These changes will be implemented in a following commit. Currently, there is a bug in the image picker which results in the max width and height to only be applied on android. This is still an improvement over the previous library but will need to be kept in mind so when that bug is fixed we can upgrade. See ivpusic/react-native-image-crop-picker#604
This issue only seems to happen with multiple images is selected. the cropping is completely ignored when multiple is set to true on android |
Since this seems to be an issue that's been around a while, i suggest using: https://github.com/bamlab/react-native-image-resizer Note: i had an issue with that package regarding SDK vesions, so I had to add this to android/build.grade:
then i imported it and did this where react-native-image-crop-picker fails to resize/crop (possibly compress as well, didnt' check), it's a quick WIP: ImagePicker.openPicker({
mediaType: "photo",
multiple: true,
maxFiles: 4,
width: 1080,
height: 1350,
cropping: true,
compressImageMaxWidth: 1080,
compressImageMaxHeight: 1350,
}).then((image) => {
// console.log(image);
const imagesArray = [];
if (Platform.OS === "android") {
for (let i = 0; i < image.length; i++) {
const { path, mime } = image[i];
let compressFormat;
if (mime === 'image/jpeg') {
compressFormat = 'JPEG';
} else if (mime === 'image/png') {
compressFormat = 'PNG';
}
console.log(image[i]);
// null means images are stored in cache folder e.g. context.getCacheDir()
// probably be a good idea to clean/delete after using the compressed files for upload
ImageResizer.createResizedImage(path, 1080, 1350, compressFormat, 100, 0, null)
.then((response) => {
console.log(response);
// send to server for upload w/e
// response.path is the path of the new image
})
.catch((err) => {
// TODO:
// Oops, something went wrong. Check that the filename is correct and
// inspect err to get more details.
});
} else {
// do ios stuff here etc send to server etc w/e
}` But otherwise react-native-image-crop-picker works perfectly for my needs and it is very much appreciated! This isn't the most practical or prettiest solutions, but seem like this will have to do for users who want multiple images and want resize/compressed to work on android. At least for now, until this gets addressed at some point. |
Update the implementation of image uploading in ComposeMenu.js We adopt react-native-image-crop-picker in favor of the old library (react-native-image-picker). This gives us the additional ability to downsample and downscale images before uploading them and also allows selecting multiple images in the same selection ( iOS only for now ). These changes will be implemented in a following commit. Currently, there is a bug in the image picker which results in the max width and height to only be applied on android. This is still an improvement over the previous library but will need to be kept in mind so when that bug is fixed we can upgrade. See ivpusic/react-native-image-crop-picker#604
So this fork seems to provide the fix for images respecting the max compressed width/height (https://github.com/ChrisLahaye/react-native-image-crop-picker) |
Update the implementation of image uploading in ComposeMenu.js We adopt react-native-image-crop-picker in favor of the old library (react-native-image-picker). This gives us the additional ability to downsample and downscale images before uploading them and also allows selecting multiple images in the same selection ( iOS only for now ). These changes will be implemented in a following commit. Currently, there is a bug in the image picker which results in the max width and height to only be applied on android. This is still an improvement over the previous library but will need to be kept in mind so when that bug is fixed we can upgrade. See ivpusic/react-native-image-crop-picker#604
This is due to a bug in the compressor it used. |
When will it be fixed, or should be choosed another compressor. |
some updates? |
I used this. It is working so far ! Thanks a lot ! |
Version
Platform
Steps to reproduce
Image only compress, can't resize with below options
The text was updated successfully, but these errors were encountered: