2

I have a problem. What I wanted is that when a user oppen the image picker, he have a free cropping functions but limited with an aspect ratio of 1.4 at maximum with a max height of about 1000, and 1/3 at minimum and a min width of about 200. But I didn't see any way to do it even after many researchs.

Please can someone help me?

This is my code here :

const takePhotoFromCamera = () => {
    ImagePicker.openCamera({
      compressImageMaxWidth:640,
      compressImageMaxHeight:1000,
      cropping: true,
      freeStyleCropEnabled:true,
    }).then((image) => {
      // console.log(image);
      const imageUri = Platform.OS === 'ios' ? image.sourceURL : image.path;
      const {cropRect} = image;
      const ImgDimensions = {width: cropRect.width, height: cropRect.height};
      setImage(imageUri);
      setImgDims(ImgDimensions);
      // console.log("Image Dimensions: ", imgDims);
    });
  };

  const choosePhotoFromLibrary = () => {
    ImagePicker.openPicker({
      compressImageMaxWidth:640,
      compressImageMaxHeight:1000,
      cropping: true,
      freeStyleCropEnabled:true,
      compressImageQuality:0.8,
      ra
    }).then((image) => {
      console.log(image);
      const imageUri = Platform.OS === 'ios' ? image.sourceURL : image.path;
      const {cropRect} = image;
      const ImgDimensions = {width: cropRect.width, height: cropRect.height};
      setImage(imageUri);
      setImgDims(ImgDimensions);
      // console.log("Image Dimensions: ", imgDims);
    });
  };

0 Answers0