Post by tingwing » Mon Sep 02, 2024 4:47 pm

hi
on the product detailed page ,the showing product image would auto-add white space/side ,

how to make the white space/side to be black in order to be consistent with the website black background color?

thanks
Last edited by tingwing on Mon Sep 09, 2024 8:01 pm, edited 2 times in total.

my extension:https://www.opencart.com/index.php?rout ... estshop24h
email :support@bestshop24h.com
site:http://www.bestshop24h.com


Active Member

Posts

Joined
Tue Aug 02, 2016 9:01 pm

Post by WaxedPerfection » Mon Sep 02, 2024 6:48 pm

a link would be good to view the area.

not loading >> http://www.bestshop24h.com/

https://www.waxedperfection.co.uk/ Car Detailing Product Blog's and Review's


Active Member

Posts

Joined
Sun Mar 26, 2017 8:23 pm

Post by paulfeakins » Tue Sep 03, 2024 7:23 pm

tingwing wrote:
Mon Sep 02, 2024 4:47 pm
on the product detailed page ,the showing product image would auto-add white space/side ,
This question has been asked and answered many times, please search before posting.

Locking topic.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by tingwing » Mon Sep 09, 2024 12:10 pm

if using png image ,it is ok,the auto-add space's color is
the same as the background color

but if using jpg image,it is not ok,the auto-add space's color is different from the background color ,it is white color,how to change the auto-add white space to be black?

Attachments

联想截图_20240909121021.png

联想截图_20240909121021.png (1.08 MiB) Viewed 1367 times


Active Member

Posts

Joined
Tue Aug 02, 2016 9:01 pm

Post by softmonke » Mon Sep 09, 2024 12:31 pm

Open up "image.php" located in "system/library".

Look for the following code under the "resize" function, and change the "255, 255, 255":

Code: Select all

$background = imagecolorallocate($this->image, 255, 255, 255);
to whatever colour your background is using in rgb format. For example, if your website's background is rgb(0, 0, 0), then you should update it to:

Code: Select all

$background = imagecolorallocate($this->image, 0, 0, 0);

Check out our ever-growing list of extensions for OpenCart here.
Some useful extensions for a better admin experience: Image File Manager ProDrag & Drop Sort Order

Reach out to us at hello@softmonke.com for your OpenCart web development needs or feedback for our extensions.


User avatar
Active Member

Posts

Joined
Tue May 23, 2023 4:42 am


Post by tingwing » Mon Sep 09, 2024 12:44 pm

thanks for reply, what you said is the sam as what chatGPT4,i also feel it is the right solution ,but no good luck,still show white space.
i have go to system/library/image.php ,and change

Code: Select all

$background = imagecolorallocate($this->image, 255, 255, 255);
to

Code: Select all

$background = imagecolorallocate($this->image, 0, 0, 0);
and refresh the theme and SASS ,and refresh the modification and clear browser cache ...

Active Member

Posts

Joined
Tue Aug 02, 2016 9:01 pm

Post by nonnedelectari » Mon Sep 09, 2024 1:40 pm

tingwing wrote:
Mon Sep 09, 2024 12:44 pm
thanks for reply, what you said is the sam as what chatGPT4,i also feel it is the right solution ,but no good luck,still show white space.
i have go to system/library/image.php ,and change

Code: Select all

$background = imagecolorallocate($this->image, 255, 255, 255);
to

Code: Select all

$background = imagecolorallocate($this->image, 0, 0, 0);
and refresh the theme and SASS ,and refresh the modification and clear browser cache ...
Deleted your old cached images?

Active Member

Posts

Joined
Thu Mar 04, 2021 6:34 pm

Post by tingwing » Mon Sep 09, 2024 2:57 pm

thanks ,you are correct,now problem solved, yes ,need to go to delete all the images in image/cache

Active Member

Posts

Joined
Tue Aug 02, 2016 9:01 pm

Post by JNeuhoff » Mon Sep 09, 2024 4:34 pm

Glad to hear you got it to work now. Please add '[SOLVED]' to the beginning of your original forum thread title.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by softmonke » Tue Sep 10, 2024 4:04 am

tingwing wrote:
Mon Sep 09, 2024 12:44 pm
thanks for reply, what you said is the sam as what chatGPT4,i also feel it is the right solution ,but no good luck,still show white space.
i have go to system/library/image.php ,and change

Code: Select all

$background = imagecolorallocate($this->image, 255, 255, 255);
to

Code: Select all

$background = imagecolorallocate($this->image, 0, 0, 0);
and refresh the theme and SASS ,and refresh the modification and clear browser cache ...
Just wanted to chime in and clarify that my solution did not come from ChatGPT. I prefer Claude nowadays anyway. :laugh:

Check out our ever-growing list of extensions for OpenCart here.
Some useful extensions for a better admin experience: Image File Manager ProDrag & Drop Sort Order

Reach out to us at hello@softmonke.com for your OpenCart web development needs or feedback for our extensions.


User avatar
Active Member

Posts

Joined
Tue May 23, 2023 4:42 am

Who is online

Users browsing this forum: No registered users and 13 guests