chore: Проверки для типов
This commit is contained in:
parent
6fdc3eb46b
commit
5d3fae4249
15 changed files with 125 additions and 42 deletions
|
|
@ -144,7 +144,7 @@ class Drawing
|
|||
$temp_x = $x;
|
||||
for ($i = 0; $i < mb_strlen($text); $i++) {
|
||||
$bbox = imagettftext($image, $size, $angle, $temp_x, $y, $color, $font, $text[$i]);
|
||||
$temp_x += $spacing + ($bbox[2] - $bbox[0]);
|
||||
$temp_x += $spacing + ($bbox !== false ? ($bbox[2] - $bbox[0]) : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,11 @@ class Image
|
|||
{
|
||||
$width = imagesx($image);
|
||||
$height = imagesy($image);
|
||||
|
||||
$percent = min($prewidth / $width, $preheight / $height);
|
||||
if ($percent > 1 && !$force) $percent = 1;
|
||||
if ($percent > 1 && !$force) {
|
||||
$percent = 1;
|
||||
}
|
||||
$new_width = $width * $percent;
|
||||
$new_height = $height * $percent;
|
||||
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ class TemplateImage
|
|||
|
||||
/**
|
||||
* Создает пустое изображение
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @param int<1, max> $width
|
||||
* @param int<1, max> $height
|
||||
*/
|
||||
function setEmptyImage($width, $height): void
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue