Forum

Thread tagged as: Api, Runway, Shop

Specifying thumbnail sizes with the API asset importer

We are importing product images with the API. How do you specify for example 2 types of thumbnails?

    $result = $Importer->add_item([
            'type'   => 'image',
            'bucket' => 'default',
            'path'   => __DIR__.'/images/0C7A1073.jpg',
        ]);

Do we have to add an array of thumbnail sizes?

Lexi McGee

Lexi McGee 3 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You'd specify that in your template as normal.

templates/content/image.html ?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Whichever template you're using. If you're importing with PerchShopProductImporter then it'll be your product template - usually product.html

That worked Drew. Now how do you specify or select that custom image size that was generated? transmitter-nm-956-3-w248h260.jpg

Drew McLellan

Drew McLellan 2638 points
Perch Support

Again, in your template. None of this is different from basic use. Use the same width, height and crop attributes.