/*
* @param link {string} URI of the image on the server
* @param name {string} Name of the image with extension
*/
_downloadAndCrop = (link, name, cropSize = { width: 200, height: 200 }) => {
FileSystem.downloadAsync(
link,
name
)
.then(({ uri }) => {
console.log('Finished downloading to ', uri);
//Your new cropped image
const cropImage = ImageManipulator.manipulate(uri, [
crop: {
originX: 0,
originY: 0,
width: cropSize.width,
height: cropSize.height
}
}], {});
})
.catch(error => {
console.error(error);
});
}
2 回答
您可以使用
Expo#FileSystem
下载图像,然后使用_466899裁剪缓存的图像 . 这是一个示例您可以使用方面4:3,16:9,1:1等
你从画廊得到照片吗?