Post by Qphoria » Fri Jul 09, 2010 11:10 pm

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

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by jzeltman » Fri Sep 03, 2010 12:03 am

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.

Newbie

Posts

Joined
Wed Sep 01, 2010 1:34 am

Post by Qphoria » Fri Sep 03, 2010 12:06 am

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

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by jzeltman » Fri Sep 03, 2010 12:12 am

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.

Newbie

Posts

Joined
Wed Sep 01, 2010 1:34 am

Post by jzeltman » Fri Sep 03, 2010 4:41 am

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?

Newbie

Posts

Joined
Wed Sep 01, 2010 1:34 am

Post by popular » Mon Sep 06, 2010 11:18 pm

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?

New member

Posts

Joined
Sun Jul 25, 2010 10:50 pm

Post by jzeltman » Fri Sep 10, 2010 11:05 pm

So I finally cracked the case.

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

Newbie

Posts

Joined
Wed Sep 01, 2010 1:34 am

Post by Tee.Mothiba » Thu Jul 11, 2013 6:51 am

ive followed your solution but still remain with the white background on the home page image... can you create a vqmod

Car DVD Navigation, 2 din Navigation,Car Radio, In-dash Navigation, Car Audio and Rear View Camera Store - South Africa - http://www.soundlouder.co.za

[/b]


New member

Posts

Joined
Sun Nov 11, 2012 6:42 pm

Post by Qphoria » Wed Jul 17, 2013 9:25 pm

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

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Tee.Mothiba » Wed Jul 17, 2013 9:36 pm

Hi Qphoria

Im actually using the latest oc version 1.5.5.1

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

Car DVD Navigation, 2 din Navigation,Car Radio, In-dash Navigation, Car Audio and Rear View Camera Store - South Africa - http://www.soundlouder.co.za

[/b]


New member

Posts

Joined
Sun Nov 11, 2012 6:42 pm

Post by Qphoria » Thu Jul 18, 2013 4:52 am

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.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Tee.Mothiba » Thu Jul 18, 2013 6:09 am

could the problem actually reside in my settings and if so can you correct them for me

Car DVD Navigation, 2 din Navigation,Car Radio, In-dash Navigation, Car Audio and Rear View Camera Store - South Africa - http://www.soundlouder.co.za

[/b]


New member

Posts

Joined
Sun Nov 11, 2012 6:42 pm

Post by cargogirl » Mon Oct 28, 2013 7:25 am

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

ADG - Design, Development and Hosting in Australia


User avatar
New member

Posts

Joined
Fri Aug 23, 2013 2:11 pm

Post by cargogirl » Mon Oct 28, 2013 11:38 am

but now i puts black behind all product imges and can't overide this in the CSS - back to the drawing board!

ADG - Design, Development and Hosting in Australia


User avatar
New member

Posts

Joined
Fri Aug 23, 2013 2:11 pm
Who is online

Users browsing this forum: No registered users and 44 guests