Skip to main content
Back to plugins
@capgo/capacitor-photo-library
Tutorial
by github.com/Cap-go

Photo Library

Browse, save, and manage photos and videos in device photo library with permissions

Guide

Tutorial on Photo Library

Using @capgo/capacitor-photo-library

Capacitor plugin Displays photo gallery as web page, or boring native screen which you cannot modify but require no authorization.

Install

bun add @capgo/capacitor-photo-library
bunx cap sync

What This Plugin Exposes

  • checkAuthorization - Returns the current authorization status without prompting the user.
  • requestAuthorization - Requests access to the photo library if needed.
  • getAlbums - Retrieves the available albums.
  • getLibrary - Retrieves library assets along with URLs that can be displayed in the web view.

Example Usage

checkAuthorization

Returns the current authorization status without prompting the user.

import { PhotoLibrary } from '@capgo/capacitor-photo-library';

await PhotoLibrary.checkAuthorization();

requestAuthorization

Requests access to the photo library if needed.

import { PhotoLibrary } from '@capgo/capacitor-photo-library';

await PhotoLibrary.requestAuthorization();

getAlbums

Retrieves the available albums.

import { PhotoLibrary } from '@capgo/capacitor-photo-library';

await PhotoLibrary.getAlbums();

getLibrary

Retrieves library assets along with URLs that can be displayed in the web view.

import { PhotoLibrary } from '@capgo/capacitor-photo-library';

await PhotoLibrary.getLibrary();

Full Reference