/** * get the image processor * * @access protected * @return Varien_Image_Adapter_Gd2 * @author Ultimate Module Creator */ protected function _getImageProcessor() { if (is_null($this->_imageProcessor)) { $this->_imageProcessor = Varien_Image_Adapter::factory('GD2'); $this->_imageProcessor->keepFrame($this->_keepFrame); $this->_imageProcessor->keepAspectRatio($this->_keepAspectRatio); $this->_imageProcessor->constrainOnly($this->_constrainOnly); } return $this->_imageProcessor; }
$thumb = $thumbPrefix . $dispersionPath; $thumbInfo = $s3->getObjectInfo($bucket, $thumb, $compareThumbsBySize); //Check if thumb exists in the bucket if ($thumbInfo && !$_reuploadThumbs) { echo 'Thumb ', $thumb, ' exists', "\n"; continue; } if (!file_exists($thumb) || $recalculateThumbs) { //Create directories for the thumb createDirectory(substr($thumb, 0, strlen($thumbPrefix) + 4)); $adapter = new Varien_Image_Adapter_Gd2(); //Default settings from Mage $adapter->keepAspectRatio(true); $adapter->keepFrame(false); $adapter->keepTransparency(true); $adapter->constrainOnly(true); $adapter->backgroundColor(array(255, 255, 255)); $adapter->quality(100); try { $adapter->open($image); $adapter->resize($dimension['width'], $dimension['height']); $adapter->save($thumb); } catch (Exception $e) { echo 'Can\'t resize ', $image, ' (', $e->getMessage(), ')', "\n"; continue; } } if (file_exists($thumb)) { if ($compareThumbsBySize && $thumbInfo && filesize($thumb) == $thumbInfo['size']) { echo 'Thumb ', $thumb, ' has same size on S3. Ignoring', "\n"; continue;