Change background color of images in magento
I found the following solution for changing the background color of images. I have overwritten the Catalog/Helper/Image class, so the background color is changed in the whole theme and it isn’t necessary to overwrite the template files.
Create a class in app/code/local/Foo/Catalog/Helper/Image.php
class Foo_Catalog_Helper_Image extends Mage_Catalog_Helper_Image { public function init(Mage_Catalog_Model_Product $product,$attributeName,$imageFile = null) { parent::init($product,$attributeName,$imageFile); $this->backgroundColor(array(60,60,60)); return $this; } }
Overwriting the helper class in the app/code/local/Foo/Bar/etc/config.xml
<?xml version="1.0"?> <config> <global> <helpers> <catalog> <rewrite> <image>Foo_Catalog_Helper_Image</image> </rewrite> </catalog> </helpers> </global> </config>