0.0.2 • Published 1 year ago

capacitor-gallery v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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 sync

Video 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>
ParamType
optionsGetGalleryItemsOptions

Returns: Promise<GetGalleryItemsResponse>


Interfaces

GetGalleryItemsResponse

PropType
countnumber
resultsGalleryItem[]
nextOffsetnumber
nextMaxQuantitynumber

GalleryItem

PropType
idstring
base64Imagestring
creationDatestring

GetGalleryItemsOptions

PropType
quantitynumber
offsetnumber
0.0.2

1 year ago

0.0.1

1 year ago