Media APIs

previewImage

Preview images in full-screen mode with zoom and swipe capabilities.

Overview

my.previewImage displays images in full-screen preview mode. Users can swipe between images, zoom in/out, and view images from a list of URLs.

The Preview image's "local image path" is not supported.

Sample Code

my.previewImage({
  current: 2,
  urls: [
    'https://img.example.com/example1.jpg',
    'https://img.example.com/example2.jpg',
    'https://img.example.com/example3.jpg'
  ],
});

Parameters

The incoming parameter is of the Object type with the following attributes:

| Property | Type | Required | Description | | --- | --- | --- | | urls | Array | Yes | Http url list of the images to be previewed. | | current | Number | No | Index of the current displayed image, 0 by default, indicating the first image in the URLs. | | success | Function | No | Callback function upon call success. | | fail | Function | No | Callback function upon call failure. | | complete | Function | No | Callback function upon call completion (to be executed upon either call success or failure). |

Usage Notes

  • Only HTTP/HTTPS URLs are supported - local image paths are not supported
  • The current parameter sets which image is displayed first (zero-indexed)
  • Users can swipe left/right to navigate between images
  • Pinch to zoom is supported