hhunaid / react-native-image-crop-tools

Native-ish Image Crop Tools for react native
171 stars 58 forks source link

In Android, it gives same file name of multiple images when it create cropped image. #60

Open jugalkishors opened 2 years ago

jugalkishors commented 2 years ago

It's give me "tempfile.jpg" and i create again a cropped image then new image is replaced with first image due to same name. so how i can change file name of image?

AdnanAshraf7 commented 2 years ago

we faced the same issue . We solved it by moving that image to different location with different name using react-native-fs .

efstathiosntonas commented 2 years ago

solution here: https://github.com/hhunaid/react-native-image-crop-tools/issues/62#issuecomment-1054039871

javier2409 commented 2 years ago

I'm having a similar issue but in my case it only happens if I try to crop two (or more) images in a row with little time in between.

I'm making an application where users can select a certain amount of images from the gallery and then they are presented those images one by one so they can crop them or leave them as they are, the thing is that if a user crops two images quickly without waiting any time in between this bug happens

@efstathiosntonas's solution didn't work because this seems to be caused by something else as the filenames i'm getting are not "tempfile.jpg" but "tempfile{some_UUID}.jpg" instead, where the UUID is the same when this bug happens.

I've solved it for now using @AdnanAshraf7's solution by copying the image to a different location inside the onImageCrop callback and using a promise to prevent the user from pressing the button again until this whole process finishes.