When sending catalog data to your channels (Shopify, Magento, ChannelAdvisor, etc), you can customize the feed template to transform your data in many different ways. RetailOps provides custom methods for calling media URLs to send through the feed.
media_url
There are two methods to fetch media URLs: media_url and media_urls. As you can likely guess, the difference between them is that media_url returns a single URL while media_urls returns all URLs specified by the parameters.
The media_url method should follow the format below. For a list of format codes, refer to the Available Media Formats section below:
sku.media_url('format code', 'image tags')
To grab the media URL for an image tagged with "hero" and render it as a 800x800 jpeg, you would enter:
sku.media_url('jpeg-800x800', 'hero')
media_urls
If the channel's feed requires all media URLs passed through the same field, you would use the media_urls method here.
The media_urls method should follow the format below:
sku.media_urls('format code', number of media URLs desired, 'media tags')
To grab 4 media URLs with various tags and render them as 600x300 png images, you would enter:
sku.media_urls('png-600x300', 4, 'hero, front, back, side')
Optional: Base URL Override Parameter
There is an optional parameter that you can use to override the default base URL for the media URLs. This parameter would go after the image tags:
sku.media_urls('format code', number of image URLs desired, 'image tags', 'domain')
Using the example above, we'll grab 4 image URLs with various tags and render them as 600x300 png images. We'll also change the base URL to 'www.yourstore.com/media':
sku.media_urls('png-600x300', 4, 'hero, front, back, side', 'http://www.yourstore.com/media')
Media from SKU vs. SKU Group vs. Family
You have the option to grab media URLs from three different pools: SKU, SKU group, or family.
sku.media_url('jpeg-800x800', 'hero')
sku_group.media_url('jpeg-800x800', 'hero')
family.media_url('jpeg-800x800', 'hero')
Each of these evaluates a different pool of images before providing a media URL. This may result in different media URLs being output.
In the first example, only images associated with the given SKU are evaluated. The media URL for the 'hero' image associated with that SKU is output.
In the third example, all images in the product family for a SKU are evaluated. If there are multiple images with 'hero' tags, only the first image's URL is output.
In the second example, all images within a SKU group are evaluated. SKU groups are more granular groups within a product family that you can define based on a set of common attributes. All SKUs within a product family that have the same values for the specified attributes will be in the same SKU group. In this example, all the images associated with the SKUs in the SKU group will be evaluated; the URL for the first image with a 'hero' tag will be output. To configure SKU groups, please contact RetailOps Support.
Available Media Formats
The table below provides a list of available media formats and their dimensions.
Unfixed vs. Fixed Dimensions
Note that media may be rendered in unfixed or fixed dimensions. Media formats 10-16, 19, and 25 all have fixed dimensions; all others are unfixed.
For unfixed media formats, the dimensions specified are the max dimensions for the image. However, the image won't necessarily be rendered in those exact dimensions. RetailOps will take the original image and shrink it down (maintaining the correct aspect ratio to prevent warping) until both dimensions are at or under the max dimensions.
By contrast, for fixed media formats, the dimensions specified will be the exact dimensions of the image. RetailOps will take the original image and shrink it down (again, maintaining the correct aspect ratio) until both dimensions are at or under the max dimensions. Then whitespace will be added around the image so that it meets the exact dimensions specified.
In the example below, the original image has dimensions of 1500x996. Using the jpeg-500x500 format, this would output an image at 500x332. Using the jpeg-fixed500x500 format, this image is still shrunken to 500x332. But then whitespace is added to bring the width from 332 to 500 pixels, outputting an image at 500x500.
Comments
2 comments
Really great article Quan! Thanks for writing this, as I'm sure it was not a quick project.
Thanks Jason! Glad it was helpful for you.
Please sign in to leave a comment.