react-native-image-resizer/index.ios.js

22 lines
590 B
JavaScript
Raw Normal View History

2015-11-29 19:58:58 +00:00
import {
NativeModules,
} from 'react-native';
export default {
createResizedImage: (path, width, height, format, quality, rotation = 0, outputPath) => {
if (format !== 'JPEG' && format !== 'PNG') {
throw new Error('Only JPEG and PNG format are supported by createResizedImage');
2015-11-29 19:58:58 +00:00
}
return new Promise((resolve, reject) => {
NativeModules.ImageResizer.createResizedImage(path, width, height, format, quality, outputPath, (err, resizedPath) => {
2015-11-29 19:58:58 +00:00
if (err) {
return reject(err);
}
resolve(resizedPath);
});
});
},
};