capacitor-gallery
v0.0.2
Published
plugin to grab assets from device filesystems
Readme
capacitor-gallery
Plugin to grab assets from device filesystems. Any contributions are welcome!
Requirements
You need to include following permissions in Android Manifest:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />You need to configure info.plist for ios build:
- Privacy - Photo Library Additions Usage Description
- Privacy - Photo Library Usage Description
Install
npm install capacitor-gallery
npx cap syncVideo Examples
Code Example
CapacitorGallery.getGalleryItems({
quantity: 20,
offset: 0
})
.then((result) => {
console.log(result)
});Instead of loading all assets you can use offset to split all assets by groups and load them as you need them. See an example
API
getGalleryItems(...)
getGalleryItems(options: GetGalleryItemsOptions) => Promise<GetGalleryItemsResponse>| Param | Type |
| ------------- | ------------------------------------------------------------------------- |
| options | GetGalleryItemsOptions |
Returns: Promise<GetGalleryItemsResponse>
Interfaces
GetGalleryItemsResponse
| Prop | Type |
| --------------------- | -------------------------- |
| count | number |
| results | GalleryItem[] |
| nextOffset | number |
| nextMaxQuantity | number |
GalleryItem
| Prop | Type |
| ------------------ | ------------------- |
| id | string |
| base64Image | string |
| creationDate | string |
GetGalleryItemsOptions
| Prop | Type |
| -------------- | ------------------- |
| quantity | number |
| offset | number |
