Post by jeeremie » Fri Nov 09, 2007 1:41 am

Hello,

On the Category page, an annoying white background is displayed for each image of the products list. I have this problem when I resize images to 120x180 in the "Image" section of the Settings page.

I tried to set the css like this but nothing happen:

Code: Select all

.products, .images, .categories {
	float: left;
        background-color: #282828;
	text-align: center;
	cursor: pointer;
	font-size: 10px;
	margin-bottom: 10px;
}
.products a, .images a, .categories a {
	font-size: 10px;
        background-color: #282828;
}
.products img, .images img, .categories img {
	margin-bottom: 2px;
        width: 120px;
        background-color: #282828;
}
Any ideas?
Last edited by jeeremie on Sun Nov 11, 2007 1:43 am, edited 1 time in total.

Newbie

Posts

Joined
Sat Jul 28, 2007 8:46 pm


Post by ogun » Fri Nov 09, 2007 4:17 am

haven't tested this so it could be wrong..

the white background is part of the image, not a property of the html/css.

in library/image/image.php on line 53, it allocates a background colour for the resized image:
[php]
$background  = imagecolorallocate($destination, 255, 255, 255);
[/php]
if you change that to the rgb value you require (e.g. 40, 40, 40) then it should be okay.

if that fixes it then it might be worth putting a request in the 1.0 request thread for the resized image background colour as a setting.

Active Member

Posts

Joined
Tue Aug 14, 2007 6:04 am

Post by jeeremie » Fri Nov 09, 2007 4:32 am

Thanks Oqun,

unfortunately, it didn't work.

I found the line you talked about but it was in the folder "include/image.php", line 54.

I changed the values to 40,40,40 but nothing happened.

Newbie

Posts

Joined
Sat Jul 28, 2007 8:46 pm


Post by ogun » Fri Nov 09, 2007 4:36 am

did you resize the images again to update the files?

Active Member

Posts

Joined
Tue Aug 14, 2007 6:04 am

Post by jeeremie » Fri Nov 09, 2007 4:40 am

What do you mean exactly? Why do you want I resize the images? Where? In the "images" section of settings? On my computer?

???

Newbie

Posts

Joined
Sat Jul 28, 2007 8:46 pm


Post by ogun » Fri Nov 09, 2007 5:03 am

haven't looked at it in detail to say for sure, but i think the setting you changed:
"resize images to 120x180 in the "Image" section of the Settings page"
created new images at the resolution you specified (120x180) rather than just applying 'width=120 height=180' to the image tag or the css for displaying the image.

so if you go back and do the same thing again now that you've changed that bit of code, it should generate new files with the new background colour.

Active Member

Posts

Joined
Tue Aug 14, 2007 6:04 am

Post by beata » Fri Nov 09, 2007 7:10 am

Did you deleted the files in the image/cache directory?

Newbie

Posts

Joined
Thu Nov 01, 2007 8:41 pm

Post by jeeremie » Fri Nov 09, 2007 6:04 pm

Thanks to both of you.

I have deleted the images in the folder image and did what Oqun told me to do. It works great!

So I understood what does Opencart. When you set the size 120x180px in the "image" section of the Settings, Opencart create some JPG images with size 120x180px and white background in the folder "image".

For example, my image name is various-0001.png. Opencart created a JPG image called various-0001-120x185.jpg. As my image is not exactly 120x180px, Opencart fill the borders with the white background. All, I had to do was to delete various-0001-120x185.jpg, change the setting as Oqun suggested and opencart created a new JPG image various-0001-120x185.jpg but with transparent background this time.

Thanks again, guys. I could not do it without you.

Newbie

Posts

Joined
Sat Jul 28, 2007 8:46 pm

Who is online

Users browsing this forum: No registered users and 3 guests