mirror of
https://github.com/status-im/react-native-image-resizer.git
synced 2025-02-17 17:17:25 +00:00
On iOS, when cropping an image with ImageEditor, it returns an uri starting with rct-image-store which could not be read by this module
22 lines
515 B
JavaScript
22 lines
515 B
JavaScript
import {
|
|
NativeModules,
|
|
} from 'react-native';
|
|
|
|
export default {
|
|
createResizedImage: (path, width, height, format, quality) => {
|
|
if (format !== 'JPEG') {
|
|
throw new Error('Only JPEG format is supported by createResizedImage');
|
|
}
|
|
|
|
return new Promise((resolve, reject) => {
|
|
NativeModules.ImageResizer.createResizedImage(path, width, height, quality, (err, resizedPath) => {
|
|
if (err) {
|
|
return reject(err);
|
|
}
|
|
|
|
resolve(resizedPath);
|
|
});
|
|
});
|
|
},
|
|
};
|