Strip out invalid characters from tile background
This commit is contained in:
parent
9ca2078e7d
commit
9f0abb6f4d
1 changed files with 2 additions and 1 deletions
|
@ -43,7 +43,8 @@ function get_brightness($hex)
|
|||
{
|
||||
// returns brightness value from 0 to 255
|
||||
// strip off any leading #
|
||||
$hex = str_replace('#', '', $hex);
|
||||
// $hex = str_replace('#', '', $hex);
|
||||
$hex = preg_replace("/[^0-9A-Fa-f]/", '', $hex);
|
||||
if (strlen($hex) == 3) {
|
||||
$hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue