chore: Проверки к типам
This commit is contained in:
parent
5d3fae4249
commit
8786e84568
12 changed files with 41 additions and 47 deletions
|
|
@ -81,6 +81,9 @@ class Drawing
|
|||
for ($i = 0; $i < $count; $i++) {
|
||||
$item = $words[$i];
|
||||
$dimensions = imagettfbbox($size, $angle, $font, $current_line . ($first_word ? '' : ' ') . $item);
|
||||
if ($dimensions === false) {
|
||||
continue;
|
||||
}
|
||||
$line_width = $dimensions[2] - $dimensions[0];
|
||||
$line_height = $dimensions[1] - $dimensions[7];
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,8 @@ class Image
|
|||
if ($percent > 1 && !$force) {
|
||||
$percent = 1;
|
||||
}
|
||||
$new_width = $width * $percent;
|
||||
$new_height = $height * $percent;
|
||||
|
||||
$new_width = max(1, (int)($width * $percent));
|
||||
$new_height = max(1, (int)($height * $percent));
|
||||
|
||||
$image_p = imagecreatetruecolor($new_width, $new_height);
|
||||
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue