Functions

listImages()

Overview

List all of the images and the metadata availible on the device's external storage. Returns a table in which the keys are image IDs and the values are metadata tables.

Syntax

local images = photoLibPlus.listImages()

copyImage(pathToImage, imageName, destinationPath)

Overview

Copies an image found through listImages() to a folder from which the image can be displayed.

Syntax

local tempDirPath = system.pathForFile("", system.TemporaryDirectory)
photoLibPlus.copyImage(metadata["_data"], "image--"..tostring(photoID)..".png", tempDirPath)

pathToImage (required)

String. The path of the image you want to copy. This can be retrieved for the "_data" key of the metadata table retrieved in the listImages() call.

imageName (required)

String. Unique name of the image you want to create. Can reuse the original name or create a new name.

destinationPath (required)

String. Path of the destination folder.

createThumbnail(photoID, options)

Overview

Request the operating system to create a new thumbnail for a given photo. Additionally, save the thumbnail to a given directory using various parameters. Returns a table with the metadata of the thumbnail.

Syntax

local options = {name = "thumbnail--"..tostring(photoID)..".png",
                 path = tempDirPath,
                 width = 512,
                 height = 384,
                 contentMode = "fit"}
local thumbnail = photoLibPlus.createThumbnail(photoID, options)

photoID (required)

Number. The photo ID retrieved from the listImages() call.

options (required)

Table. A table of options to specify size, name, and destination of the thumbnail. Parameters:

name (required)

String. Unique name of the thumbnail you want to save. Can reuse the original name or create a new name.

path (required)

String. Path of the destination folder.

width (required)

Number. iOS Only. The maximum width in pixels of the thumbnail. On Android, the width is always 512.

height (required)

Number. iOS Only. The maximum height in pixels of the thumbnail. On Android, the width is always 512.

contentMode (required)

String. iOS Only. An option for how to fit the image to the aspect ratio of the requested size. Possible values are "fit" and "fill". On Android, the contentMode is always "fit".