Image
Magento\Catalog\Model\Product\Image
What it does
This class handles product image processing operations in Magento 2, including resizing, watermarking, quality adjustment, and caching.
Developers use it to manipulate product images programmatically, generate image variants with specific dimensions or effects, and manage image assets across the catalog.
It's commonly used in custom image rendering, product galleries, and when creating optimized images for different display contexts.
Public Methods
- setWidth()
- getWidth()
- setHeight()
- getHeight()
- setQuality()
- getQuality()
- setKeepAspectRatio()
- setKeepFrame()
- setKeepTransparency()
- setConstrainOnly()
- setBackgroundColor()
- setSize()
- setBaseFile()
- getBaseFile()
- getNewFile()
- isBaseFilePlaceholder()
- setImageProcessor()
- getImageProcessor()
- resize()
- rotate()
- setAngle()
- setWatermark()
- saveFile()
- getUrl()
- setDestinationSubdir()
- getDestinationSubdir()
- isCached()
- setWatermarkFile()
- getWatermarkFile()
- setWatermarkPosition()
- getWatermarkPosition()
- setWatermarkImageOpacity()
- getWatermarkImageOpacity()
- setWatermarkSize()
- setWatermarkWidth()
- getWatermarkWidth()
- setWatermarkHeight()
- getWatermarkHeight()
- clearCache()
- getResizedImageInfo()