Camera Roll

Save Images from your App to the User's Device.

The Despia Camera Roll SDK enables your application to save images directly to the user's device. This feature enhances your app by providing users with offline access to images, making sharing easier, improving user engagement, and simplifying image access.

Quick Start

1. Identify the Image to Save

Define the image URL you want to save to the user's device, this can either be a CDN URL or a locally generated blob image URL (base64 data URLs are not permitted).

const image = "https://example.com/image.jpg"

2. Save the Image to Camera Roll

Use the Despia protocol with the savethisimage:// command to save the image to the user's device.

window.despia = `savethisimage://?url=${image}`

3. Verify Successful Saving

This step is completed automatically by the SDK, which handles the image saving process in the background.

How It Works

The Camera Roll SDK utilizes a custom URL protocol to communicate with the native device functionality. When you call the savethisimage:// command, the SDK handles all the necessary permissions and saves the specified image to the user's camera roll or photo gallery.

Implementation Examples

Here's a basic implementation example showing how to save an image to the user's camera roll:

// Simple implementation
const image = "https://example.com/image.jpg"
window.despia = `savethisimage://?url=${image}`

// After successful save update UI if needed

Data Structure

The Camera Roll SDK uses a simple URL parameter structure to specify the image to be saved:

`savethisimage://?url=${imageUrl}`

Best Practices

User Experience

  • Notify users when an image is being saved

  • Confirm successful saves with appropriate feedback

  • Request permissions before saving images

  • Consider the native success feedback

Performance

  • Ensure image URLs are properly encoded

  • Validate image URLs before attempting to save

Need Help?

For additional support or questions, please contact our support team at support@despia.com

Updated on