From 9f0abb6f4d08876a73046c155072e056c81e5342 Mon Sep 17 00:00:00 2001 From: Kode Date: Mon, 21 Mar 2022 21:37:14 +0000 Subject: [PATCH] Strip out invalid characters from tile background --- app/Helper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Helper.php b/app/Helper.php index 99c28681..73f4b0fe 100644 --- a/app/Helper.php +++ b/app/Helper.php @@ -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]; }