Plugin to grab assets from device filesystems. Any contributions are welcome!
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
npm install capacitor-gallery
npx cap syncCapacitorGallery.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
getGalleryItems(options: GetGalleryItemsOptions) => Promise<GetGalleryItemsResponse>| Param | Type |
|---|---|
options |
GetGalleryItemsOptions |
Returns: Promise<GetGalleryItemsResponse>
| Prop | Type |
|---|---|
count |
number |
results |
GalleryItem[] |
nextOffset |
number |
nextMaxQuantity |
number |
| Prop | Type |
|---|---|
id |
string |
base64Image |
string |
creationDate |
string |
| Prop | Type |
|---|---|
quantity |
number |
offset |
number |

