Documentation
Feedback
Guides
Storefront Development

Storefront Development
Store Framework
Managing performance
Rendering images

Images play a vital role in building your brand’s visual identity, but they can also impact your store's performance. To balance aesthetics and speed, Store Framework provides several image blocks, each designed for specific use cases.

This guide outlines best practices for handling images in your Store Theme to maintain both performance and consistency.

Best practices for uploading images

Follow these guidelines to upload images efficiently and avoid performance issues:

  • Use the Assets Builder or Site Editor to upload images. These tools handle cropping automatically, ensuring a consistent user experience.
  • Avoid hardcoding image URLs in the blocks.json file. Doing so may cause image deformation.
  • Do not use images with large dimensions. Images with large dimensions might not crop correctly in the Site Editor, leading to display issues.

List of image blocks

The Store Framework offers several image blocks, each suited to different use cases. Selecting the appropriate block will help maintain performance and visual consistency:

  • Logo: Use this block to render your brand’s logo, typically in the header or footer.
  • Infocard: Ideal for displaying images with links and call-to-action buttons. Use this block when you want to guide users with image-based CTAs.
  • Rich Text: A versatile block for rendering markdown text, which can also include images. Use this when text and images are combined.
  • Product Summary Image: Renders the product image attached to a product summary information (e.g., name, price). It is often used within other store components like the Shelf.
  • Image: A simple block for rendering standalone images without additional elements like links or text. Use this block when you just need to display an image.

Configuring the Product Summary Image Block

When using the Product Summary block, configure at least one of the following props:

  • aspectRatio
  • width
  • height
  • maxHeight

These props define image dimensions and enable you to let product summary images be of identical size when rendered, even if the images submitted in the Admin's Catalog are of a different size.

These props define the image's dimensions and allow product summary images to be presented with the same size, regardless of the dimensions of the images uploaded via the admin's Catalog.

You do not need to define all four properties in your Product Summary Image block at the same time. Each property has a unique purpose and can be configured based on your specific needs. For more information, refer to the Product Summary Image documentation.

For example, by declaring these props, your store's Shelf will have image consistency across all products being displayed, differently from the Shelf example below:

{"base64":"  ","img":{"width":2192,"height":1016,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":712774,"url":"https://cdn.jsdelivr.net/gh/vtexdocs/dev-portal-content@main/images/vtex-io-documentation-best-practices-for-rendering-images-0.png"}}

Contributors
1
Photo of the contributor
+ 1 contributors
Was this helpful?
Yes
No
Suggest edits (Github)
Contributors
1
Photo of the contributor
+ 1 contributors
On this page