Post by scubi » Mon Aug 04, 2008 3:26 pm

making the product images (portrait ones) background clear.

I have a personal photography print shop and I have pictures in both Landscape (more wide than tall) and Portrait (Taller than wide).
The Landscape ones are fine but the portrait ones have white on each side of the picture.
Is there any code I can insert (say css/default or some place?) that can make the background of the image transparent?

Any and all help is appreciated. I don't konw much about coding but I'm learning so much just in the little under a week I've been in this community.

Maybe somewhere in here? Again, I have no idea this is just guessing. I thought I better ask the experts before I start meddling and breakdown my store.

*Start*
220>  .products, .images, .categories {
float: left;
width: 33.3%;
text-align: center;
cursor: pointer;
font-size: 10px;
height: 140px;
}

.categories a {
text-decoration: none;
}

.images a {
font-size: 10px;
}

.images img, .categories img {
border: 0px;
margin-bottom: 10px;
}

242   .results {
*end*


Thanks again,
Scubi

Newbie

Posts

Joined
Sat Aug 02, 2008 11:52 am

Post by bruce » Mon Aug 04, 2008 3:38 pm

The white background is created in the actual image when it is resized by opencart. Even files with transparent backgrounds will end up with white.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by scubi » Mon Aug 04, 2008 3:50 pm

Ah... Gotcha.

I can live with it.
Thanks for the info. :)

Scubi

Newbie

Posts

Joined
Sat Aug 02, 2008 11:52 am

Post by JohnnyO » Mon Aug 04, 2008 11:35 pm

You need to add this --> http://us3.php.net/imagesavealpha to your php.ini file or somewhere else.  I don't have any experience with GD but others here do.

-JO
Last edited by JohnnyO on Mon Aug 04, 2008 11:39 pm, edited 1 time in total.

If you make it idiot proof, they will just build a better idiot.


User avatar
New member

Posts

Joined
Wed Nov 14, 2007 7:31 am
Location - Denver, CO - USA

Post by Luvz2drv » Tue Aug 05, 2008 6:27 am

it is actually setup that way in code...

in the library/images/image.php file line53  $background  = imagecolorallocate($destination, 255, 255, 255);

http://www.experts-exchange.com/Web_Dev ... 49792.html

post an example of keeping the alpha of the image...   sorry i don;t have time to see if this can be worked in or not..

also on this note... all images that are resized....  are saved/cached as a jpeg  not as there orginal type...  this controller may need to be expanded to handle this operation
ex  original file type gif -> resized = jpg

Jonathon
Last edited by Luvz2drv on Tue Aug 05, 2008 6:31 am, edited 1 time in total.

Global Moderator

Posts

Joined
Fri Mar 21, 2008 10:58 am

Post by jballotti » Tue Sep 02, 2008 8:08 am

bruce wrote: The white background is created in the actual image when it is resized by opencart. Even files with transparent backgrounds will end up with white.
How do you stop OpenCart from resizing the images?

Newbie

Posts

Joined
Sun Aug 10, 2008 9:45 pm
Location - Chicago Area

Post by fido-x » Tue Sep 02, 2008 9:12 am

Image resizing is done by the relevant controller using the width and height values set in the administration.

If you wish to change the size of thumbnail images, go to Admin->Configuration->Setting->Image. You can also turn image resizing off if you wish, by setting "Resize Images" to "No" on this page.

Regards, Fido-X.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia
Who is online

Users browsing this forum: No registered users and 1 guest