shopify-images

1.0.0 • Public • Published

Shopify Images

A generic Javascript utility for Shopify img_url size parameters.

Installation

# with NPM
npm install --save shopify-images

# or with Yarn
yarn add shopify-images

Usage

const ShopifyImage = require('shopify-images');

const imageSrc = '//cdn.shopify.com/s/files/1/1405/0664/products/4791207-9790062099-Pizza1.jpg';
const options = {
  size: 'x320'
};

ShopifyImage(imageSrc, options);
// => '//cdn.shopify.com/s/files/1/1405/0664/products/4791207-9790062099-Pizza1_x320.jpg'

Options

Options should be passed as an object. Please see Shopify's size parameters for documentation.

All Options

{
  size: '320x320',
  crop: 'center',
  scale: '2',
  format: 'pjg'
}

This will translate to...

//cdn.shopify.com/s/files/1/1405/0664/products/4791207-9790062099-Pizza1_320x320_center@2x.progressive.jpg

Package Sidebar

Install

npm i shopify-images

Weekly Downloads

49

Version

1.0.0

License

MIT

Unpacked Size

10.2 kB

Total Files

5

Last publish

Collaborators

  • lukeshumard