Skip to main content
Back to plugins
@capgo/capacitor-photo-library
Tutorial
@capgo/capacitor-photo-library

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

Keep going from Using @capgo/capacitor-photo-library

If you are using Using @capgo/capacitor-photo-library to plan native media and interface behavior, connect it with @capgo/capacitor-photo-library for the implementation detail in @capgo/capacitor-photo-library, Getting Started for the implementation detail in Getting Started, Using @capgo/capacitor-live-activities for the native capability in Using @capgo/capacitor-live-activities, @capgo/capacitor-live-activities for the implementation detail in @capgo/capacitor-live-activities, and Using @capgo/capacitor-video-player for the native capability in Using @capgo/capacitor-video-player.