Humanities Home page   Office of Digital Humanities
Back     BYU LiveCode Lessons Gateway

Mobile Photo Album and Camera Control

LiveCode provides several language features for choosing photos from the device's built-in photo library, and for taking a still photograph with the device's built-in camera. Following is a summary of the commands and functions you can use to control the camera and access the photo album. You can find details on how to use them by searching the LiveCode Dictionary for each token.

mobilePickPhoto command

This command allows the user to select an image to display using a native photo picker.


mobilePickPhoto source, maxwidth, maxheight

Where source is one of the following:

Note that the maxwidth and maxheight parameters are only available in iOS. They specify the maximum allowable width and height of the chosen image.


put the width of this stack div 2 into tMaxWidth
put the height of this stack div 2 into tMaxHeight
mobilePickPhoto "library", tMaxWidth, tMaxHeight

The stack "testMobileControls.livecode" that we examined in class shows a simple example of the use of this command as well as the other functions and commands on this page.

mobileCameraFeatures function

This function queries the features of the specified camera and returns the results as a comma-delimited list.



Where camera is one of the following:


put mobileCameraFeatures("front") into tFeatureList

For instance, in a test on an iPad 3rd Generation, this statement:

put mobileCameraFeatures() into fld "display"

Produced the following list:

front photo,front video,rear photo,rearvideo

mobileExportImageToAlbum command

This command saves an image to the user's photo album (iOS) or default pictures folder (Android).


mobileExportImageToAlbum imageData or longImageID, fileName

Where imageData is the binary data of an image object (e.g., the text of image "foo")

- or -

longImageID is a long id reference to an image object.


put the long id of last image into tImgID
mobileExportImageToAlbum tImgID

The fileName parameter is optional, and is the name under which the image is to be saved on the Android file system.

The mobileExportImageToAlbum command returns empty in the result if exporting succeeded. Otherwise it returns one of:

Back     BYU LiveCode Lessons Gateway
Maintained by Devin Asay.
Copyright © 2005 Brigham Young University.
This page last updated on July 11, 2022 09:50:19.