You can grab images from three sources:

    Camera – Opens the device camera and retrieves the captured photo.

  • Library – Images stored in the Saved Photos album.
  • Web – Remotely hosted web images can be saved locally.


After you have your image, you can save it in the following locations:

  • Locally – On the device in a temporary folder.
  • Web – Upload the image to a remote location.
  • Album – Inside the Saved Photos album.

 

file

File information returned from an uploaded image.


Syntax:

lg.image.file;

Returns:

  • (object) Image information from callback.
    • url – (string) The url returned from the server.
    • name – (string) the filename of the image uploaded.
    • type – (float) The type of image being uploaded.
    • size – (string) THe size of the uploaded image in kilobytes.


Example:

var fileSize = lg.image.file.size;

Back to Top

 

 

error

Error object can be retrieved from this property if an error occurs.


Syntax:

lg.image.error;

Returns:

  • (object) Error object.


Example:

var errorDesc = lg.image.error.desc;

Back to Top

 

 

camera

Open the device camera. When a photo is taken and accepted, upload it to a specified url.


Syntax:

lg.camera(obj);

Arguments:

  1. obj – (object) An object containing the variables to use.
    • edit – (string) A url pointing to the webservice or upload script.
    • filename – (string) The name to assign to the file when uploaded.
    • quality – (float) The quality of the JPG output. Ranges from 1 being the best to 0 being the worst.
    • url – (string) A url pointing to the webservice or upload script.


Event Trigger:

  • lg_image_camera


Example:

lg.camera({'url':'http://localhost/tmp/upload.php', 'filename':'myPhoto.jpg'});

Back to Top

 

 

library

Open the device library. When a photo is selected, upload it to a specified url.


Syntax:

lg.library(obj);

Arguments:

  1. obj – (object) An object containing the variables to use.
    • edit – (string) A url pointing to the webservice or upload script.
    • filename – (string) The name to assign to the file when uploaded.
    • quality – (float) The quality of the JPG output. Ranges from 1 being the best to 0 being the worst.
    • url – (string) A url pointing to the webservice or upload script.


Event Trigger:

  • lg_image_library


Example:

lg.library({'url':'http://localhost/tmp/upload.php', 'filename':'myPhoto.jpg'});

Back to Top