---
name: "chooseCropImage"
mode: "kit"
versionRequirements:
  - { name: "BaseKit", version: "2.2.4" }
platform:
  - "iOS"
  - "Android"
async: true
---

## chooseCropImage

> [VERSION] BaseKit >= 2.2.4

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Select an image from the local album or take a photo with the camera (cropping supported)

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `sourceType` | `string[]` | No | `["album", "camera"]` | `2.2.4` | Image source: ['album', 'camera']; both are supported by default |
| `complete` | `() => void` | No | - | - | Callback invoked when the API call completes (runs on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback invoked on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Callback invoked on failed API call |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `path` | `string` | `3.2.6` | Local temporary file path of the cropped image |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extensions |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Extended error code |
| `errorMsg` | `string` | Extended error information |


### Examples

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