mirror of
https://github.com/status-im/react-native-image-resizer.git
synced 2025-01-26 06:32:26 +00:00
af9f77d965
* Add outputPath for android * Add outputPath for ios * Update readme * Move outputPath to the end * Update readme
22 lines
553 B
JavaScript
22 lines
553 B
JavaScript
import {
|
|
NativeModules,
|
|
} from 'react-native';
|
|
|
|
export default {
|
|
createResizedImage: (path, width, height, format, quality, rotation = 0, outputPath) => {
|
|
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, outputPath, (err, resizedPath) => {
|
|
if (err) {
|
|
return reject(err);
|
|
}
|
|
|
|
resolve(resizedPath);
|
|
});
|
|
});
|
|
},
|
|
};
|