camSetup

Camera

Sets the default options for the camera, which would be used in capturePic, choosePic and choosePicFromAlbum methods. This method is particularly useful to set camera options when using the mowbly Photo widget.

$m.camSetup({

quality: $m.CAM_QUALITY_MED,

width: 100,

height: 100

});

Syntax

        $m.camSetup(options)

Parameters

options

object (required)  

Camera configuration options with one or many of following properties,

  1. allowEdit- {Optional. Boolean}. If true, user is allowed to edit the picture after capturing it in the native camera app. Default value is false. Supported in iOS only.

  1. filePath - {Optional. String/File}. Path to store the captured/chosen picture. The path, if provided as string is considered relative to the pack folder. If the path is provided as an empty string, the picture is written to the photos gallery. Refer getFile method to get a mowbly file object. Default value is path of photos gallery.

  1. type - {Optional. Integer}. Format in which the captured picture is stored . Default value is $m.CAM_JPG. Supported values are,
  1. $m.CAM_JPG
  2. $m.CAM_PNG

  1. quality - {Optional. Number}. Quality of the picture. Default value is $m.CAM_QUALITY_MED. This quality value denotes the compression rate of the picture. Higher the quality higher the time taken to process the picture and the memory usage. Supported values are:
  1. $m.CAM_QUALITY_LOW
  2. $m.CAM_QUALITY_MED
  3. $m.CAM_QUALITY_HIGH

  1. readData - {Optional. Boolean}. Flag that denotes if the picture data should be returned to the fp_callback function. The picture data will be a base64 encoded string. It is recommended to use the path returned to the fp_callback function to render the picture in the page or to upload the picture to server (Refer postMultipart method for details.). Reading picture data would increase the memory usage of the app, hence this property should be used only when absolutely needed. Default value is false.

  1. width - {Optional. Integer}. Width of the picture in pixels. Default value is 320. The width is applied before the picture is written to the filePath or photos gallery.

  1. height - {Optional. Integer}. Height of the picture in pixels. Default value is 480. The height is applied before the picture is written to the filePath or photos gallery.

Remarks

The native Camera app returns the picture as per its settings and it is usually the highest resolution possible. Based on the app needs, resize the image by mentioning the options.width and options.height dimensions. Combination of these dimensions and quality parameter decide the final crispness of the picture.