chooseCropImage(params: Object)

Requires:
BaseKit≥2.2.4@ray-js/ray≥0.3.23
Platforms:
iOSAndroid
import { chooseCropImage } from '@ray-js/ray';

// Promise usage
try {
  const res = await chooseCropImage({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Select images from the album or take photos with the camera (cropping supported)

Parameters

PropertyTypeRequiredDefaultDescription
sourceTypestring[]No["album", "camera"]Sources for selecting images ['album', 'camera']; both supported by default
complete() => voidNo-Completion callback (executed on both success and failure)
success(params: Object) => voidNo-Callback on successful API call
fail(params: Object) => voidNo-Failure callback
success callback parameters
PropertyTypeDescriptionBaseKit Since
pathstringLocal temporary file path of the cropped imagev3.2.6
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

import { chooseCropImage } from '@ray-js/ray'

// Select an image and crop (invokes the system picker; manual selection required)
chooseCropImage({
  sourceType: ["album", "camera"],
  success: data => console.log("Cropped path:", data.path),
  fail: error => console.error(error),
});