Magento Forum

   
change the background colour of thumbnails
 
purplemine
Sr. Member
 
Total Posts:  143
Joined:  2008-05-20
London
 

Hi,

I need to change the default background colour of the image thumbnails to black, maybe I am missing a config somewhere.

I have looked in the lib folder and found the image functions but would rather not change the core if possible.

Thanks,

 
Magento Community Magento Community
Magento Community
Magento Community
 
joyously
Guru
 
Total Posts:  447
Joined:  2008-08-21
 

There is no need for a background color. All the thumbnail functions would do is resize your image, so whatever is in your image is what you get. Nothing added.
So if you want black, make your image black.

 
Magento Community Magento Community
Magento Community
Magento Community
 
purplemine
Sr. Member
 
Total Posts:  143
Joined:  2008-05-20
London
 

When the images are resized for the thumbnail, a new image is created from the image with dimensions 1:1 so that the image sits correctly on the page.  By default the matte on this image is white.

I need to adjust this as my site doesn’t not have a white background.

I have uploaded a picture to demonstrate

Image Attachments
Picture 1.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
nekosan
Member
 
Avatar
Total Posts:  32
Joined:  2008-07-15
 

app\core\mage\catalog\model\product\image.php

right at the top, in the property definitions

protected $_backgroundColor  = array(226225225);

change it to whatever you want, if you want to change it for the entire website

or if you want to change it per page/template basis, use the method

public function setBackgroundColor(array $rgbArray)
in your template file

 
Magento Community Magento Community
Magento Community
Magento Community
 
PattyR
Jr. Member
 
Total Posts:  13
Joined:  2008-08-13
 

I would prefer to define background colors in my css, and find it rather odd that they would define color in the php files.  How do I edit the line so that NO background color displays?

I tried this:
protected $_backgroundColor = false;
and the images disappeared.

I tried removing line 43 and that resulted in an error.

I am not a php developer so any help would be greatly appreciated

 
Magento Community Magento Community
Magento Community
Magento Community
 
littleblue
Jr. Member
 
Total Posts:  14
Joined:  2007-12-05
 

I also have this problem with multishops.

Did anybody find a solution or explanation how the background color canbe assigned using CSS?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top