Hi,
A very little typo in the code prevented (at least my installation) to have background colors being taken into account for 3 states buttons. The same color was used for all three states. See screenshots attached.
I attach one of of the smallest patches possible, which solves the issue for me : just a 3 characters difference with the original :)
Replace Line 800
if (!$image->transparent && empty($image->bgimage[$idx])) {
imagefilledrectangle ($image->im, $xofs, $yofs , $xofs + $width, $yofs+ $height, $image->background[$idx]);
}
with
if (!$image->transparent[0] && empty($image->bgimage[$idx])) {
imagefilledrectangle ($image->im, $xofs, $yofs , $xofs + $width, $yofs+ $height, $image->background[$idx]);
}
Hope this helps someone!
Jun.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 753044-signwriter-fix-transparency.patch | 1.5 KB | smoothify |
| #2 | signwriter-bgcolors3state.patch | 816 bytes | ronhoogwater |
| signwriter-bgcolors3state.patch | 471 bytes | jun | |
| After3BG.png | 4.3 KB | jun | |
| BeforeSameBG.png | 3.5 KB | jun |
Comments
Comment #1
jun commentedI found another problem in the code which made it that the third background color wasn't taken into account.
It's an even smaller patch (a less or equal issue apparently), I'm just including the code change here:
Line 748.
should be
How about including these baby patches in beta3?
Best,
Jun.
Comment #2
ronhoogwater commentedHello,
I have done some research as well, because my site depends on this functionality.
I agree with your first suggestion, Jun. After testing I applied your patch to my running website and it works great!
However there is another typo in line 760 that makes the first state background color always transparent, even if you have not set the transparent checkbox.
I think there was meant
since $image->transparent is an array with only one item set.
But this enlights other problems:
With comment #1 I do not agree. The original loops over $idx= 0, 1, 2. This seems correct to me, since $idx = 3 does not exist.
I attached a patch that fixes both typos.
edit: @Jun: I now realize I don't understand why you didn't have the problem with the first state background always being transparent (maybe a different php version?). And why your third background is not rendered. Does your suggestion in comment #1 fix this third background?
Comment #3
smoothify commentedI experienced similar issues with the transparency setting, especially when using multi-state images.
Even when i selected no transparency, the image was still transparent.
Here is a patch on the same lines as above that should fix it.