メインコンテンツまでスキップ
バージョン: v2

Photos

The Photos API provides methods to load photos and albums from the user's photo library, along with saving photos.

API

getPhotos(...)

getPhotos(options?: PhotosFetchOptions) => Promise<PhotosResult>

Get photos from the user's photo library

ParamType
options
PhotosFetchOptions

Returns:

Promise<PhotosResult>


getAlbums(...)

getAlbums(options?: PhotosAlbumsFetchOptions) => Promise<PhotosAlbumsResult>

Get albums from the user's photo library

ParamType
options
PhotosAlbumsFetchOptions

Returns:

Promise<PhotosAlbumsResult>


savePhoto(...)

savePhoto(options?: PhotosSaveOptions) => Promise<PhotosSaveResult>

Save a photo the the user's photo library

ParamType
options
PhotosSaveOptions

Returns:

Promise<PhotosSaveResult>


createAlbum(...)

createAlbum(options: PhotosCreateAlbumOptions) => Promise<void>

Create an album in the user's photo library

ParamType
options
PhotosCreateAlbumOptions

Interfaces

PhotosResult

PropTypeDescription
photosPhotoAsset[]The list of photos returned from the library

PhotoAsset

PropTypeDescription
identifierstringPlatform-specific identifier
datastringData for a photo asset as a base64 encoded string (JPEG only supported)
creationDatestringISO date string for creation date of asset
fullWidthnumberFull width of original asset
fullHeightnumberFull height of original asset
thumbnailWidthnumberWidth of thumbnail preview
thumbnailHeightnumberHeight of thumbnail preview
location
PhotoLocation
Location metadata for the asset

PhotoLocation

PropTypeDescription
latitudenumberGPS latitude image was taken at
longitudenumberGPS longitude image was taken at
headingnumberHeading of user at time image was taken
altitudenumberAltitude of user at time image was taken
speednumberSpeed of user at time image was taken

PhotosFetchOptions

PropTypeDescription
quantitynumberThe number of photos to fetch, sorted by last created date descending
thumbnailWidthnumberThe width of thumbnail to return
thumbnailHeightnumberThe height of thumbnail to return
thumbnailQualitynumberThe quality of thumbnail to return as JPEG (0-100)
typesstringWhich types of assets to return (currently only supports "photos")
albumIdentifierstringWhich album identifier to query in (get identifier with getAlbums())

PhotosAlbumsResult

PropTypeDescription
albumsPhotosAlbum[]The list of albums returned from the query

PhotosAlbum

PropTypeDescription
identifierstringLocal identifier for the album
namestringName of the album
countnumberNumber of items in the album
type
PhotosAlbumType
The type of album

PhotosAlbumsFetchOptions

PropTypeDescription
loadSharedbooleanWhether to load cloud shared albums

PhotosSaveResult

PropTypeDescription
successbooleanWhether the photo was created

PhotosSaveOptions

PropTypeDescription
datastringThe base64-encoded JPEG data for a photo (note: do not add HTML data-uri type prefix)
albumIdentifierstringThe optional album identifier to save this photo in

PhotosCreateAlbumOptions

PropType
namestring

Enums

PhotosAlbumType

MembersValueDescription
Smart"smart"Album is a "smart" album (such as Favorites or Recently Added)
Shared"shared"Album is a cloud-shared album
User"user"Album is a user-created album