/** * @return MagentoImage */ public function getImageProcessor() { if (!$this->_processor) { $filename = $this->getBaseFile() ? $this->_mediaDirectory->getAbsolutePath($this->getBaseFile()) : null; $this->_processor = $this->_imageFactory->create($filename); } $this->_processor->keepAspectRatio($this->_keepAspectRatio); $this->_processor->keepFrame($this->_keepFrame); $this->_processor->keepTransparency($this->_keepTransparency); $this->_processor->constrainOnly($this->_constrainOnly); $this->_processor->backgroundColor($this->_backgroundColor); $this->_processor->quality($this->_quality); return $this->_processor; }
/** * Setup base image properties for resize * * @param \Magento\Framework\Image $image * @param bool $isSwatch * @return $this */ protected function setupImageProperties(\Magento\Framework\Image $image, $isSwatch = false) { $image->quality(100); $image->constrainOnly(true); $image->keepAspectRatio(true); if ($isSwatch) { $image->keepFrame(true); $image->keepTransparency(true); $image->backgroundColor('#FFF'); } return $this; }
/** * Image Processor * * @return \Magento\Framework\Image */ public function getImageProcessor() { if (!$this->processor) { $filename = $this->getBaseFile(); $this->processor = $this->imageFactory->create($filename); } $this->processor->keepAspectRatio(true); $this->processor->keepFrame($this->keepFrame); $this->processor->keepTransparency($this->keepTransparency); $this->processor->constrainOnly($this->constrainOnly); $this->processor->backgroundColor($this->backgroundColor); $this->processor->quality($this->quality); return $this->processor; }