Media APIs

saveImage

Save online images to the device camera gallery.

Overview

my.saveImage saves online images from a URL to the device's camera gallery.

Sample Code

my.saveImage({
  url: 'https://img.example.com/example.jpg'
});

Parameters

PropertyTypeRequiredDescription
urlStringYesURL of the image to be saved.
showActionSheetBooleanNoWhether to show the menu when saving image. By default, it is false.
successFunctionNoCallback function upon call success.
failFunctionNoCallback function upon call failure.
completeFunctionNoCallback function upon call completion (to be executed upon either call success or failure).

Error Code

ErrorDescription
2Invalid parameter, no url parameter transferred.
15Album right not enabled (iOS only).
16Insufficient album storage on cellphone (iOS only).
17Other errors during picture saving.

Usage Notes

  • The url parameter is required and must be a valid image URL
  • Set showActionSheet: true to display a menu when saving
  • The image is saved directly to the device's photo gallery
  • Requires proper permissions to write to the gallery