Log in
Helper

Image

Magento\Catalog\Helper\Image

What it does

The Image helper class is used to generate and manipulate product images in Magento 2.

Developers use this class to initialize product images with specific dimensions, apply transformations like resize, rotate, and watermark, and generate URLs for displaying images in templates.

It handles image configuration, placeholder images, and ensures proper caching and optimization of product images throughout the catalog.

Public Methods

  • init()
  • resize()
  • setQuality()
  • keepAspectRatio()
  • keepFrame()
  • keepTransparency()
  • constrainOnly()
  • backgroundColor()
  • rotate()
  • watermark()
  • placeholder()
  • getPlaceholder()
  • getUrl()
  • save()
  • getResizedImageInfo()
  • getDefaultPlaceholderUrl()
  • setWatermarkSize()
  • setWatermarkImageOpacity()
  • setImageFile()
  • getOriginalWidth()
  • getOriginalHeight()
  • getOriginalSizeArray()
  • getType()
  • getWidth()
  • getHeight()
  • getFrame()
  • getLabel()