vishalkoradiya / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

Patch for $canvas_color with 3-char notation #337

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I often use the 6-char notation for hex colors  ( e.g #F90 instead of #FF9900),
so i edited a check on $canvas_color length to aumaticly change the 3-char 
string in 6-char string.
Also i edited the default on error (string length != 6) white canvas color with 
the default DEFAULT_CC. 

I also would to notice a weird behavior: sometimes the canvas color is 
decreased by 1. I don't know why or when:

112233 => #112232 - error on blue
556677 => #556676 - error on blue
AABBCC => #AABBCB - error on blue
FF00FF => #FF00FE - error on blue
CCFF55 => #CBFF55 - error on red
CC4455 => #CD4456 - error on red and blue
CCDD55 => #CCDC55 - error on green
998855 => #998755 - error on green

(colors are taken by mozilla plugin's 'Colorzilla')

Original issue reported on code.google.com by gianluig...@gmail.com on 12 Feb 2012 at 1:23

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I notice that with .png file the canvas colour won't show and it will add a 
transparent background.
Could be useful to make user choice this parameter with a variable, and if they 
want a bg colour you can write a if block that check mime type and the option 
and change the alpha from 127 to 0:
if [ (mime=png) and (user set in the variable) ]
$color = imagecolorallocatealpha ($canvas, $canvas_color_R, $canvas_color_G, 
$canvas_color_B, 0);
else 
$color = imagecolorallocatealpha ($canvas, $canvas_color_R, $canvas_color_G, 
$canvas_color_B, 127);
end if

Original comment by gianluig...@gmail.com on 12 Feb 2012 at 8:01

GoogleCodeExporter commented 8 years ago
I've some problem saving the patch file for this second suggestion, so i open a 
new issue (338) with description and patch file

Original comment by gianluig...@gmail.com on 12 Feb 2012 at 9:00

GoogleCodeExporter commented 8 years ago
I've applied the patch and it will be in the next commit. Thanks!

Original comment by BinaryMoon on 12 Feb 2012 at 10:14

GoogleCodeExporter commented 8 years ago
Thank you for all the work you do!
What about the weird behavior with canvas color ? I have to do another 
different post only for supposed bug ?

Original comment by gianluig...@gmail.com on 12 Feb 2012 at 10:27