Background colours on icons

9 posts by 2 authors in: Forums > CMS Builder
Last Post: May 14, 2008   (RSS)

By steve_e - May 12, 2008

Hi -
I'm getting a strange effect on some uploaded graphics, where the background colour seems to be reversed. I'm not sure why, as it isn't happening all the time. I've tried various combinations (gif or jpg files, transparent or white images etc) but some images just seem to turn out black

Any ideas?

Re: [steve_e] Background colours on icons

By Dave - May 12, 2008

Hi Steve,

Can you attach one of the files that this happens with so I can try uploading it locally and see if I get the same problem?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Background colours on icons

By steve_e - May 12, 2008

Hi Dave -
Here's a link to a page that has the 'negative' logo:

http://www.foundation-stage.info/images2/LEAs/yorklogo_001.gif

Here's the original logo that I uploaded:

Hope that works. Let me know if you need anything else.
Attachments:

yorklogo.gif 16K

Re: [steve_e] Background colours on icons

By Dave - May 13, 2008

Hi Steve,

It looks like it's being caused when the gif has a transparent background. I've added some code to the next version to keep the transparency. Note this only works if the image doesn't need to be resized. But your image shouldn't need to be resized. It will be in the next version, here's how to add it to yours (if you don't mind editing some code):

Open this file /lib/menus/default/uploadForm_functions.php

Make a backup copy!

Search for "resample image" and add this code _above_ it:


if ($scaleFactor == 1) {
copy($sourcePath, $targetPath) || die(__FUNCTION__ . ": error copying image '$sourcePath' - $php_errormsg");
return;
}


// resample image


Give that a try and let me know if it fixes it for you!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Background colours on icons

By steve_e - May 14, 2008

Hi Dave -
Yes, that seems to work - but only for images that don't need to be re-sized as you say.

Does the fix included in the next version (1.15?) allow images to be re-sized or will it still have a problem with gifs with transparent backgrounds?

Regards, Steve.

Re: [steve_e] Background colours on icons

By Dave - May 14, 2008

No, the fix doesn't support resizing transparent images yet.

Do you have many transparent images that will need to be resized?

Do you know how much they will be changing in size when they're resampled?

I can take another look at it if you like.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Background colours on icons

By steve_e - May 14, 2008

It's not too much of a problem Dave. We add new pages regularly to a series which all have logos from various organisations, and we can't predict which ones will be over a particular size and which have transparent images.

I have someone else who prepares these pages and she's not able to reprocess the images herself, so it just means that when she gets one that goes black she'll have to send it to me to remove the transparent background.

It would be good to have an eventual fix though! [:)]

Re: [Dave] Background colours on icons

By steve_e - May 14, 2008

Okey doke Dave, will do. Thanks for the prompt replies as usual! [:)]