Page 1 of 1

[MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b only)

Posted: Fri Jul 09, 2010 11:10 pm
by Qphoria
karinchan wrote:how to make the image product transparent?
Try this for transparent background ...

1. EDIT: /system/library/image.php

2. FIND:

Code: Select all

$background = imagecolorallocate($this->image, 255, 255, 255);
3. AFTER, ADD:

Code: Select all

if ($this->info['mime'] != 'image/jpg') {
			imagecolortransparent($this->image, $background);
		}
4. EDIT: catalog/model/tool/image.php

5. FIND:

Code: Select all

$new_image = 'cache/' . substr($filename, 0, strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.jpg'; 
6. REPLACE WITH:

Code: Select all

$info = pathinfo($filename);
$extension = $info['extension'];
$new_image = 'cache/' . substr($filename, 0, strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension; 
7. Delete all cached images in image/data/cache and image/cache

8. Ctrl+F5 on your browser.

Only png & gif files will support transparent background. jpg images will have no change.

DEMO:
Image

Image

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Fri Sep 03, 2010 12:03 am
by jzeltman
I've tried everything listed here and in other places. I'm quite exhausted from searching and finding solutions that aren't working. Please help.

I've upgraded to 1.4.9 and still have no luck with transparency on my product images. I've followed all of the steps listed here and elsewhere, and no luck. I've tried using 1.4.8 & 1.4.9 as is and don't have any luck, and modded 1.4.9 code with the code supplied above and no luck.

I have circular images an a gradient background and need for them to no have a white background.

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Fri Sep 03, 2010 12:06 am
by Qphoria
You are the second person to mention this... perhaps it is a server setting that is missing on some webhosts.

Ive tested this with a fresh 1.4.9 as well and I get a transparent image:
Image

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Fri Sep 03, 2010 12:12 am
by jzeltman
Thanks for the speedy response.

I'm still in development mode and working on MAMP locally. I'll create a dummy install online and see if I still have the problem.

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Fri Sep 03, 2010 4:41 am
by jzeltman
So I've created a live version (http://joshuazeltman.com/oc/index.php?r ... duct_id=49)of my site and still have white background 'png's'. I looked through the images in Cache > Data and found that the smaller versions are in jpg format while the larger versions and the icon version are in png format.

Thoughts?

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Mon Sep 06, 2010 11:18 pm
by popular
I also tried the code listed above using 1.4.8 and I tried replacing the two files listed above with the versions from 1.4.9 and still no luck! Anyone have ideas as to what server setting might be causing the difference in results?

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Fri Sep 10, 2010 11:05 pm
by jzeltman
So I finally cracked the case.

I had to physically rename the files in question the exact name of the resized images.

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Thu Jul 11, 2013 6:51 am
by Tee.Mothiba
ive followed your solution but still remain with the white background on the home page image... can you create a vqmod

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Wed Jul 17, 2013 9:25 pm
by Qphoria
Tee.Mothiba wrote:ive followed your solution but still remain with the white background on the home page image... can you create a vqmod
Best to just upgrade to 1.4.9 or higher as this is part of the core now when using png files

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Wed Jul 17, 2013 9:36 pm
by Tee.Mothiba
Hi Qphoria

Im actually using the latest oc version 1.5.5.1

here's a link to my website www.soundlouder.co.za

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Thu Jul 18, 2013 4:52 am
by Qphoria
Tee.Mothiba wrote:Hi Qphoria

Im actually using the latest oc version 1.5.5.1

here's a link to my website http://www.soundlouder.co.za
Then you don't need this mod.. resized png files should already use transparent backgrounds if they are transparent already.

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Thu Jul 18, 2013 6:09 am
by Tee.Mothiba
could the problem actually reside in my settings and if so can you correct them for me

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b, 1

Posted: Mon Oct 28, 2013 7:25 am
by cargogirl
hi
the problem still exists for gif files in 1.5.5.1

I need to load 3 large images into a slider. png files with transparent background creates a file to large and the gif is an old but still suitable solution for this particular graphic.

Why can't this be patched for 1.5.5.1?

I have implementing the above first sectin of code as the secound is updated in 1.5.5.1 and it now works

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on

Posted: Mon Oct 28, 2013 11:38 am
by cargogirl
but now i puts black behind all product imges and can't overide this in the CSS - back to the drawing board!