[MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b only)
7 posts
• Page 1 of 1
[MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b only)
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:



Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on
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.
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.
- jzeltman
- Posts: 9
- Joined: Tue Aug 31, 2010 5:34 pm
Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on
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:

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


Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on
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.
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.
- jzeltman
- Posts: 9
- Joined: Tue Aug 31, 2010 5:34 pm
Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on
So I've created a live version (http://joshuazeltman.com/oc/index.php?route=product/product&product_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?
Thoughts?
- jzeltman
- Posts: 9
- Joined: Tue Aug 31, 2010 5:34 pm
Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on
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?
- popular
- Posts: 31
- Joined: Sun Jul 25, 2010 2:50 pm
Re: [MOD] Support Transparent Backgrounds (1.4.4 - 1.4.8b on
So I finally cracked the case.
I had to physically rename the files in question the exact name of the resized images.
I had to physically rename the files in question the exact name of the resized images.
- jzeltman
- Posts: 9
- Joined: Tue Aug 31, 2010 5:34 pm
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: gocreative and 14 guests













