Skip to content

Runtime_ProductImageList_Load_Product_Variant#


Description#

This function will allow you to request a list of image sizes for a specific product or variant. You pass in dimensions as a pipe separated list and Miva will either return you back the path to those images if they already exist on the server or dynamically create them for you and return you the path.

Note

The dimensions you pass will not always be the exact dimensions returned. Miva will keep the image proportions and create an image as close to the dimensions you requested.

Request Body Parameters#

Parameter
Type Description
Session_Type String This will always be “runtime”
Product_Code String Code of product you want the images for
Image_Sizes String Pipe Delimited list of Image sizes ex: 250x250|100x100. Miva will create any images in the dimensions requested if they do not yet exist
Variant_ID Number Passed if you need the images for a specific variant (Red, Small). Variant ID would be returned in this Function

Response Parameters#

Parameter
Type Description
success boolean Boolean value for if the request was successful
type_code String Image Type Code. This will be blank if the image does not have an image type. (ex. main, alt1, etc)
image_data Array Array of relative image paths for the dimensions requested.

Note

Runtime Functions cannot be used with the multicall request format. Because this function operates on a single product at a time, limit the number of concurrent requests to a reasonable number.

Example Request#

{
    "Store_Code": "{{Store_Code}}",
    "Miva_Request_Timestamp": "{{$timestamp}}",
    "Function": "Runtime_ProductImageList_Load_Product_Variant",
    "Session_Type": "runtime",
    "Product_Code": "p1",
    "Image_Sizes": "250x250|100x100",
    "Variant_ID": 356
}

Example Response#

{
    "success": 1,
    "data": [
        {
            "type_code": "main",
            "image_data": ["graphics/00000001/mailchimp_shirt_2_250x250.jpg", "graphics/00000001/mailchimp_shirt_2_100x100.jpg"]
        },
        {
            "type_code": "",
            "image_data": ["graphics/00000001/mailchimp_shirt_red_1_250x247.jpg", "graphics/00000001/mailchimp_shirt_red_1_100x99.jpg"]
        },
        {
            "type_code": "",
            "image_data": ["graphics/00000001/mailchimp_shirt_blue_3.jpg", "graphics/00000001/mailchimp_shirt_blue_3_100x100.jpg"]
        }
    ]
}