ump-plugin-image-picker
v0.0.1
Published
UMP Image Picker — OS gallery + camera
Readme
ump-plugin-image-picker
UMP Image Picker — OS gallery + camera (Promise/Result envelope, web-aligned field names).
Install
npm install ump-plugin-image-picker --save
Usage
import { ImagePicker, imagePickerPlugin } from 'ump-plugin-image-picker';
// Register with the host plugin manager: pm.register(imagePickerPlugin());
// Pick from the system gallery: const result = await ImagePicker.launchImageLibrary({ mediaType: 'image', multiple: true, quality: 0.8, includeBase64: false, }); // result: { didCancel: boolean; assets?: PickedAsset[]; errorCode?: string }
// Or open the camera: const shot = await ImagePicker.launchCamera({ cameraType: 'back', saveToPhotos: true, });
Each PickedAsset exposes uri, fileName, mimeType, width, height,
fileSize, optionally duration (videos) and optionally base64.
Native pickers under the hood: Android ACTION_PICK / PhotoPicker, iOS
PHPickerViewController + UIImagePicker, Harmony photoAccessHelper.
See src/index.ts for the full API.
Plugin authoring
This is a UMP plugin. See docs/superpowers/specs/plugin-authoring-guide.md for the plugin model.
