mobilePickPhoto

Typecommand
DictionaryLCS
LibraryLiveCode Script
Syntax
mobilePickPhoto <source> [, <maxwidth> [, <maxheight>] ]
Synonymsiphonepickphoto
Summary

Displays the iPhone or Android native photo picker.

Introduced4.5.2
OSios, android
Platformsmobile
Parameters
NameTypeDescription
source

The source for the image.

"library":
"album":
"camera":
"rear camera":
"front camera":
maxwidth

The maximum allowed width of the image.

maxheight

The maximum allowed height of the image.

Example
mobilePickPhoto "library"
mobilePickPhoto "front camera", 250, 250
RelatedKeyword: templateImage
Description

Use the mobilePickPhoto command to allow the user to select an image.

The mobilePickPhoto displays the iPhone or Android native photo picker, allowing the user to select a photo from the device's photo library, take a photo using the device cameras or select a photo from the device's recent camera roll.

When running on an iPhone or Android, the photo-picker is displayed using the standard iOS fullscreen overlay view. The same happens when running on an iPad and the supported orientations for the app contain any of landscape right, landscape left, portrait upside down. On the contrary, when running on an iPad and the supported orientations for the app contain only portrait, then the photo-picker is displayed using a standard iOS pop-over. In this case, the pop-over is positioned relative to the rect of the target at the time the mobilePickPhoto command was called.

If the source type is not available on the target device, the command returns with result source not available. If the user cancels the pick, the command returns with result cancel. Otherwise a new image object is created on the current card of the default stack containing the chosen image.

The maxwidth and maxheight parameters constrain the maximum size of an image. The chosen image is scaled down proportionally to fit within the size specified. If either size specified is 0, then the parameter is ignored.

Note: The image object is cloned from the templateImage, so you can use this to configure settings before calling the picker.

Note: Android: mobilePickPhoto requires 'Camera' and 'External Storage' permissions. Set these in the standalone application settings pane. Not setting this permission will result in a "could not create temporary image file" error.