Magento: Change image background color
Posted by admin in Magento
If possible I always avoid modifing system core files, but in this case I couldn’t find any other solution. So to change your image background color open file /app/code/core/Mage/Catalog/Model/Product/Image.php and find:
protected $_backgroundColor = array(255, 255, 255);
and replace it with:
protected $_backgroundColor = array(0, 0, 0);
This will change the white background color to black. Change array(0, 0, 0) to whatever color you need.



Never knew that - a very handy tip - bookmarking your site!
I think you can override core files by using your ‘app/code/local’ folder, I’ve found it very handy as sometimes there is no option but to go into the code. This guy has more info on it: http://www.exploremagento.com/magento/override-a-magento-core-block-class.php
Hi,
Thanks for your information.
My website is built from Magento V1.1.8. Originally, all product image background color was white. However, on some day, all the color sudden change to BLACK. I never modify any files, no touch image.php.
So, I really don’t know why it suddenly change to black color. Can u give me some help? My website is
http://www.CocoMartini.com
Many thanks.
Regards,
Andy
all background colours
Hi Andy
check the same file and set the array to array(255, 255, 255) witch should give you white background on images.
Hi,
Thanks for your reply. I double check the file and it default value is already
protected $_backgroundColor = array(255, 255, 255);
below is part of the file and you see that I never change the value and all are default setting. Any idea? Thanks in advance.
regards,
Andy
*************
class Mage_Catalog_Model_Product_Image extends Mage_Core_Model_Abstract
{
protected $_width;
protected $_height;
protected $_keepAspectRatio = true;
protected $_keepFrame = true;
protected $_keepTransparency = true;
protected $_constrainOnly = false;
protected $_backgroundColor = array(255, 255, 255);
protected $_baseFile;
protected $_newFile;
protected $_processor;
protected $_destinationSubdir;
protected $_angle;
protected $_watermarkPosition;
protected $_watermarkWidth;
protected $_watermarkHeigth;
****************
Finally I know my online boosktore problems. The webhost company say they change the server os from redhat to Debian. and no way to solve my case.
CocoMartini.com College textbooks Online bookstore
http://www.cocomartini.com
Although I know the reason. But there are no way to solve the image background problems for my college textbooks online bookstore.
CocoMartini.com College textbooks Online bookstore
http://www.cocomartini.com
How is it possible to use this for multiple shops in Magento?
Anyone have idea why there are different if my online bookstore hosted in redhat and debian?
CocoMartini.com College textbooks Online bookstore
http://www.cocomartini.com
Andy try to put ‘background:#FFF;’ in your ‘.product-img-box .more-views li a’ class. Maybe this could work for you…
Thanks admin, but where are
‘.product-img-box .more-views li a’
Whick line for ‘background:#FFF;’?
Thanks
Andy this class is set in /skin/frontend/default/default/css/screen.css or in you custom theme if you are usin one.