Curious if you have encountered issues where your resized images have a pesky black background around them. Despite setting the background to array(255,255,255) I cannot seem to get rid of this black area around the frame....
/**
* Return the URL for the image SRC
*
* @param Mage_Catalog_Model_Category $object
* @return string
*/
public function getImageUrl($category)
{
/* @var $img FirstScribe_Client_Helper_Catalog_Category_Image */
$img = Mage::helper('firstscribe_client/catalog_category_image');
$img->init($category, 'featured_image');
$img->keepFrame(true);
$img->keepTransparency(true);
$img->keepAspectRatio(true);
$img->backgroundColor(array(255,255,255));
$img->resize(250);
return $img->__toString();
}
Example Result:
The image helper itself is a class only very slightly modified from your typical UMC image helper, geared towards catalog/category entities. I've extended it just enough to support the necessary paths:
<?php
/**
* catalog/category image helper
*
* @category FirstScribe
* @package FirstScribe_Client
* @author Darren Felton <[email protected]>
*/
class FirstScribe_Client_Helper_Catalog_Category_Image extends FirstScribe_Client_Helper_Catalog_Image_Abstract
{
/**
* image subdir
* @var string
*/
protected $_subdir = 'catalog/category';
}
<?php
/**
* abstract catalog module image helper
*
* @category FirstScribe
* @package FirstScribe_Client
* @author Darren Felton <[email protected]>
*/
abstract class FirstScribe_Client_Helper_Catalog_Image_Abstract extends FirstScribe_Client_Helper_Image_Abstract
{
/**
* get the image base dir
*
* @access public
* @return string
*/
public function getImageBaseDir()
{
return Mage::getBaseDir('media').DS.$this->_subdir.DS;
}
/**
* get the image url for object
*
* @access public
* @return string
*/
public function getImageBaseUrl()
{
return Mage::getBaseUrl('media').$this->_subdir.'/';
}
/**
* get image url
*
* @access protected
* @return mixed (string|bool)
*/
protected function _getImageUrl()
{
if (!$this->_image) {
return false;
}
if ($this->_scheduledResize) {
return $this->getImageBaseUrl().$this->_resizeFolderName.'/'.$this->_getDestinationImagePrefix().'/'.$this->_image;
} else {
return $this->getImageBaseUrl().$this->_image;
}
}
}
Finally FirstScribe_Client_Helper_Image_Abstract is the typical UMC abstract image helper
After an hour of banging my head to the wall I did find this article which is regarding this exact same topic but copying Varien_Image_Adapter_G2 to my local codePool and performing the modifications in the article yielded no results.
Any thoughts here? Have your image resizing with $imgHelper->keepFrame(true)
parameter encountered this issue before?