사진 라이브러리 __CAPGO_KEEP_0__ 저장소
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 지시를 복사하세요.
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-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 기능을 추가하려면 다음 명령어를 사용하세요:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins그런 다음 다음 명령어를 사용하세요:
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 syncImport
Import 섹션import { PhotoLibrary } from '@capgo/capacitor-photo-library';API 개요
API 개요 섹션checkAuthorization
인증 확인사용자의 인증 상태를 확인합니다. 사용자에게 인증을 요청하지 않습니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
await PhotoLibrary.checkAuthorization();requestAuthorization
권한 요청사진 앨범에 접근할 수 있는 권한이 있는지 확인합니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
await PhotoLibrary.requestAuthorization();getAlbums
앨범 목록 가져오기앨범 목록을 가져옵니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
await PhotoLibrary.getAlbums();getLibrary
앨범 라이브러리 가져오기앨범 라이브러리와 웹 뷰에서 표시할 수 있는 URL을 가져옵니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
await PhotoLibrary.getLibrary();getPhotoUrl
사진 URL 가져오기사진의 풀 리졸루션 버전의 URL을 가져옵니다.
이미 getLibrary 권한 요청 includeFullResolutionData일반적으로 이 메서드를 사용할 필요가 없습니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
await PhotoLibrary.getPhotoUrl({} as { id: string });getThumbnailUrl
Thumbnail URL을 가져오는 방법자산의 리사이즈된 썸네일 URL을 가져옵니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
await PhotoLibrary.getThumbnailUrl({} as { id: string; width?: number; height?: number; quality?: number; });pickMedia
미디어 선택사용자가 전체 사진 앨범 접근 권한을 부여하지 않고 미디어를 선택할 수 있도록 시스템 내장 선택기를 엽니다. 선택한 파일은 애플리케이션 캐시에 복사되고 포트블 URL과 함께 반환됩니다.
import { PhotoLibrary } from '@capgo/capacitor-photo-library';
await PhotoLibrary.pickMedia();타입 참조
PhotoLibrary 권한 상태PhotoLibraryAuthorizationState
클립보드 복사export type PhotoLibraryAuthorizationState = 'authorized' | 'limited' | 'denied' | 'notDetermined';PhotoLibraryAlbum
PhotoLibraryAlbumexport interface PhotoLibraryAlbum { id: string; title: string; assetCount: number;}GetLibraryOptions
GetLibraryOptionsexport 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
GetLibraryResultexport 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
PhotoLibraryFileexport 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
PickMediaOptionsexport 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
PickMediaResultexport interface PickMediaResult { assets: PhotoLibraryAsset[];}PhotoLibraryAsset
PhotoLibraryAssetexport 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
PhotoAssetTypeexport type PhotoAssetType = 'image' | 'video';실질적인 출처
Section titled “실질적인 출처”이 페이지는 플러그인의 src/definitions.tspublic API이 업스트림에서 변경될 때 다시 싱크를 실행하세요.
Getting Started에서 계속하기
Section titled “Getting Started에서 계속하기”Capgo를 사용 중이라면 Getting Started 계획 대시보드와 API 작업을 계획하고 연결하세요. Using @capgo/capacitor-photo-library Using @capgo/capacitor-photo-library API 개요 API 개요 소개 소개 API 키 API 키 기기 기기