시작하기
이 플러그인의 설치 단계와 전체 markdown 가이드가 포함된 설정 프롬프트를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-photo-library`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/photo-library/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
설치
“설치” 섹션AI 지원 설정을 사용하여 플러그인을 설치할 수 있습니다. 다음 명령어를 사용하여 AI 도구에 Capgo 기술을 추가하세요:
bunx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins그다음 아래 prompt를 사용하세요:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-photo-library` plugin in my project.Manual Setup을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르세요:
bun add @capgo/capacitor-photo-librarybunx cap sync가져오기
“Import” 섹션import { PhotoLibrary } from '@capgo/capacitor-photo-library';빠른 시작
“Quick start” 섹션import { PhotoLibrary } from '@capgo/capacitor-photo-library';
const result = await PhotoLibrary.checkAuthorization();console.log(result);예시: requestAuthorization
“Example: requestAuthorization” 섹션import { PhotoLibrary } from '@capgo/capacitor-photo-library';
const result = await PhotoLibrary.requestAuthorization();console.log(result);예시: getAlbums
“Example: getAlbums” 섹션import { PhotoLibrary } from '@capgo/capacitor-photo-library';
const result = await PhotoLibrary.getAlbums();console.log(result);자주 하는 실수
“자주 하는 실수” 섹션- 네이티브 동기화: 실행
bunx cap sync플러그인 업그레이드 후. - 단일 진실 공급원: 신뢰
src/definitions.tsGitHub 레포지토리에서.
API 개요
“API 개요” 섹션checkAuthorization
“checkAuthorization” 섹션사용자에게 prompt를 띄우지 않고 현재 권한 상태를 반환합니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
const result = await PhotoLibrary.checkAuthorization();console.log(result);requestAuthorization
“requestAuthorization” 섹션필요한 경우 사진 라이브러리 접근 권한을 요청합니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
const result = await PhotoLibrary.requestAuthorization();console.log(result);getAlbums
“getAlbums” 섹션사용 가능한 앨범 목록을 가져옵니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
const result = await PhotoLibrary.getAlbums();console.log(result);getLibrary
“getLibrary” 섹션웹 뷰에서 표시할 수 있는 URL과 함께 라이브러리 에셋을 가져옵니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
const result = await PhotoLibrary.getLibrary();console.log(result);getPhotoUrl
“getPhotoUrl” 섹션에셋의 전체 해상도 버전을 표시할 수 있는 URL을 가져옵니다.
이미 다음을 호출했다면 getLibrary 를 포함하여 includeFullResolutionData를 사용 중이라면 보통
이 메서드는 필요하지 않습니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
const result = await PhotoLibrary.getPhotoUrl({ id: 'id-123' });console.log(result);getThumbnailUrl
“getThumbnailUrl” 섹션에셋의 크기가 조정된 썸네일을 표시할 수 있는 URL을 가져옵니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
const result = await PhotoLibrary.getThumbnailUrl({ id: 'id-123' });console.log(result);pickMedia
“pickMedia” 섹션사용자가 사진 라이브러리 전체 접근 권한을 허용하지 않고도 미디어를 선택할 수 있도록 네이티브 시스템 피커를 엽니다. 선택한 파일은 앱 캐시로 복사되어 portable URL로 반환됩니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
const result = await PhotoLibrary.pickMedia();console.log(result);타입 참조
“타입 레퍼런스” 섹션PhotoLibraryAuthorizationState
“PhotoLibraryAuthorizationState” 섹션export type PhotoLibraryAuthorizationState = 'authorized' | 'limited' | 'denied' | 'notDetermined';PhotoLibraryAlbum
“PhotoLibraryAlbum” 섹션export interface PhotoLibraryAlbum { id: string; title: string; assetCount: number;}GetLibraryOptions
“GetLibraryOptions” 섹션export interface GetLibraryOptions { /** * Number of assets to skip from the beginning of the query. */ offset?: number; /** * Maximum number of assets to return. Omit to return everything that matches. */ limit?: number; /** * Include images in the result. Defaults to `true`. */ includeImages?: boolean; /** * Include videos in the result. Defaults to `false`. */ includeVideos?: boolean; /** * Include information about the albums each asset belongs to. Defaults to `false`. */ includeAlbumData?: boolean; /** * Include assets stored in the cloud (iCloud / Google Photos). Defaults to `true`. */ includeCloudData?: boolean; /** * If `true`, use the original filenames reported by the OS when available. */ useOriginalFileNames?: boolean; /** * Width of the generated thumbnails. Defaults to `512`. */ thumbnailWidth?: number; /** * Height of the generated thumbnails. Defaults to `384`. */ thumbnailHeight?: number; /** * JPEG quality for generated thumbnails (0-1). Defaults to `0.5`. */ thumbnailQuality?: number; /** * When `true`, copies the full sized asset into the app cache and returns its URL. * Defaults to `false`. */ includeFullResolutionData?: boolean;}GetLibraryResult
“GetLibraryResult” 섹션export interface GetLibraryResult { assets: PhotoLibraryAsset[]; /** * Total number of assets matching the query in the library. `assets.length` can be less * than this value when pagination is used. */ totalCount: number; /** Whether more assets are available when using pagination. */ hasMore: boolean;}PhotoLibraryFile
“PhotoLibraryFile” 섹션export interface PhotoLibraryFile { /** Absolute path on the native file system. */ path: string; /** * URL that can be used inside a web view. Usually produced by `Capacitor.convertFileSrc(path)`. */ webPath: string; mimeType: string; /** Size in bytes if known, otherwise `-1`. */ size: number;}PickMediaOptions
“PickMediaOptions” 섹션export interface PickMediaOptions { /** * Maximum number of items the user can select. Use `0` to allow unlimited selection. * Defaults to `1`. */ selectionLimit?: number; /** Allow the user to select images. Defaults to `true`. */ includeImages?: boolean; /** Allow the user to select videos. Defaults to `false`. */ includeVideos?: boolean; /** Width of the generated thumbnails for picked items. Defaults to `256`. */ thumbnailWidth?: number; /** Height of the generated thumbnails for picked items. Defaults to `256`. */ thumbnailHeight?: number; /** JPEG quality for generated thumbnails (0-1). Defaults to `0.7`. */ thumbnailQuality?: number;}PickMediaResult
“PickMediaResult” 섹션export interface PickMediaResult { assets: PhotoLibraryAsset[];}PhotoLibraryAsset
“PhotoLibraryAsset” 섹션export interface PhotoLibraryAsset { id: string; fileName: string; type: PhotoAssetType; width: number; height: number; duration?: number; creationDate?: string; modificationDate?: string; latitude?: number; longitude?: number; mimeType: string; /** Size in bytes reported by the OS for the underlying asset, if available. */ size?: number; albumIds?: string[]; thumbnail?: PhotoLibraryFile; file?: PhotoLibraryFile;}PhotoAssetType
“PhotoAssetType” 섹션export type PhotoAssetType = 'image' | 'video';기준 소스
“기준 소스” 섹션이 페이지는 플러그인의 src/definitions.ts에서 생성되었습니다. public API가 업스트림에서 변경되면 동기화를 다시 실행하세요.
Getting Started에서 계속하기
“Getting Started에서 계속하기”라는 제목의 섹션사용 중인 경우 시작하기 대시보드와 API 운영을 계획하려면, 이를 다음 항목과 연결하세요: @capgo/capacitor-photo-library 사용하기 @capgo/capacitor-photo-library를 사용하여 네이티브 기능을 구현할 때, API 개요 API Overview의 구현 상세 내용은 소개 Introduction의 구현 상세 내용은 API 키 API Keys의 구현 세부 사항은, 디바이스 Devices의 구현 세부 사항은.