TakePhoto

Definition:

TakePhoto(datasource, field)

 

Description:

Allow the user to take a photo using the device's camera.

 

Platforms:

All

 

Parameters:

datasource - required

Name of Data Source as defined within your Project in which to save the photo.

For ADO databases, include the name of the table containing the field in which the photo will be saved as well, in the format:

<datasourcename>.<table name>

Generally, this Method would only be used with database data sources.

Click here for more information about the format of this parameter.

 

field - required

Name of the field within the Data Source in which to store the photo. See Notes below for information on data types supported.

 

Returns:

0

User cancelled camera.

 

1

Photo taken.

 

Notes:

  • The operation of TakePhoto can be altered using the following options available with the SetApplicationOption Method:

    CAMERA_MEGAPIXELS - Specify maximum size, in megapixels, for an image taken with the device's camera. The Client or Standalone App will attempt to take a photo using a resolution which will result in an image equal to or greater than the size specified here. If the returned picture is larger (in megapixels) than the value specified here, it will be downscaled so that it is less than or equal to the specified size. If the size specified exceeds the device's capabilities, photos will be taken at the maximum size available. If set to 0 (zero) or below, the default value of 2.1 will be used.

     

    CAMERA_TYPE - determines whether a call to TakePhoto should allow the user to take photos using the device's native camera app, take photos using the enhanced camera facility built into the Digitise Apps Client, import existing photos or allow the user to choose which of these they want to do each time TakePhoto is called. The option to choose which camera to use is only relevant to Android and iOS devices; on the UWP and Windows Desktop Platforms, the Digitise Apps Client or Standalone App will always directly access the device's camera to take photos, whichever camera type is selected.

    If you do not specify this option, by default TakePhoto will allow the user to take photos using the default camera app on Android and iOS devices and the camera functionality built into the Client on the UWP or Windows Desktop Platforms.

     

    PHOTO_OVERLAY_TYPE – determines whether a timestamp and/or location data should be added to photos taken. If you do not specify this option, by default time and location data will not be added to photos.

     

    PHOTO_OVERLAY_HORIZONTAL_POSITION and PHOTO_OVERLAY_VERTICAL_POSITION – determine the position for the timestamp and location data within the photo, if this information is being added. The default position, if these parameters are omitted is Bottom Left.

     

     

  • If the user accepts the photograph then the image is placed into the specified field of the current record of the specified Data Source.

    To display the photo on the current form, you need to have a Picture & Video Control on the form set for use with images and input mapped to the specified field. You will then need to call RefreshControls to update the control with your new image.

  • To save the photo, you MUST call UpdateCurrentRecord to save the record to the local database before moving to a different record.

  • The Data Source field can have a data type of image, binary or varbinary.

  • The photo will be saved in jpeg format.

  • Although you need a Data Source field in which to save the photo(s) you take, saving large data items directly in the database can make your app slower. For this reason, the Properties of the Data Source field allow you to opt to save photos to file instead, which is quicker for large objects. When you need to refer to the photo, e.g. within your Scripts or to create input and output mappings, you still refer to the Data Source field within the database and Digitise Apps keeps track of the file(s) used to store your photo(s) behind the scenes.

  • By default photos are restricted to 2.1 megapixels, to prevent potential memory issues due to handling large images. You can change the maximum size of a photo using the SetApplicationOption Method (see above).


See also:

SetApplicationOption

TakeVideo