Get preview image

  • Since SDK: 1.0.0

Request the path for a local preview image. the image will be downloaded if it is not already cached.

adobe.dps.store.getPreviewImage

Parameter Type Description
productId

string

A string containing the product id of the subscription to buy.
portrait

boolean

An boolean indicating whether you want a portrait or landscape preview image
width

number

The request width of the preview (Note: This property may be ignored)
height

number

The request height of the preview (Note: This property may be ignored)
callback

getPreviewImageFunction

Function that will be called with this signature: {"result"=status, "path"=path} where status is one of "succeeded", "failed" and path is the path to the preview image

getPreviewImageFunction

Parameter Type Description
"result"

string

status is one of "succeeded" or "failed".
"path"

string

The local location of the desired preview image.

API Snippet

getPreviewImage

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>getPreviewImage API</title>
<script type="text/javascript">
function getPreviewImage()
{
  if (window.adobedpscontextloaded)
  {
    var productId = document.getElementById("productId").value;
    var portrait = document.getElementById("portrait").checked;
    var width = document.getElementById("width").value;
    var height = document.getElementById("height").value;
    // call into the getPreviewImage API
    adobe.dps.store.getPreviewImage(productId, portrait, width, height, function(data)
      {
        document.write("<p>Results: " + 
           data['result'] + " and path: " + 
           data['path'] + '</p>');
      }
    );
  }
}
</script>
</head>

<body>
<p>Get Preview Image</P>
<br>ProductId: <input type="text" id="productId" value="productId"/>
<br>Portrait: <input type="checkbox" id="portrait" checked/>
<br>Width: <input type="text" id="width" value="300"/>
<br>Height: <input type="text" id="height" value="500"/>
<button type="button" onclick="getPreviewImage()">Get Preview Image</button>
</body>
</html>