1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

Bugfix: Make errorimage() multibyte-safe

This commit is contained in:
Starbeamrainbowlabs 2019-10-22 21:44:20 +01:00
parent 4701d24bd7
commit 1ef86f117c
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -463,7 +463,7 @@ function errorimage($text, $target_size = null)
(count($text_lines) - 1) * $line_spacing + (count($text_lines) - 1) * $line_spacing +
$border_size * 2; $border_size * 2;
foreach($text_lines as $line) foreach($text_lines as $line)
$width = max($width, $font_width * strlen($line)); $width = max($width, $font_width * mb_strlen($line));
$width += $border_size * 2; $width += $border_size * 2;
} }
@ -473,7 +473,7 @@ function errorimage($text, $target_size = null)
$i = 0; $i = 0;
foreach($text_lines as $line) { foreach($text_lines as $line) {
imagestring($image, $font_size, imagestring($image, $font_size,
($width / 2) - (($font_width * strlen($line)) / 2), ($width / 2) - (($font_width * mb_strlen($line)) / 2),
$border_size + $i * ($font_height + $line_spacing), $border_size + $i * ($font_height + $line_spacing),
$line, $line,
imagecolorallocate($image, 68, 39, 113) // #442772 imagecolorallocate($image, 68, 39, 113) // #442772