PHP Nette - TypeError Argument must be of the type int, float given

PHP Nette - TypeError Argument must be of the type int, float given

Ahoj,

na serveru s PHP 7.4 mně přestala fungovat operace s obrázky ( Nette\Utils\Image::fromBlank() ), kterou používám v Nette. Dříve to jelo bez problémů. Nevíte co to je za chybu? Díky

CHYBA:

TypeError
Argument 2 passed to Nette\Utils\Image::fromBlank() must be of the type int, float given, called in /var/www/is_dev/vendor/nette/utils/src/Utils/Image.php on line 392 search►

    .../vendor/nette/utils/src/Utils/Image.php:392	

  Nette\Utils\Image::fromBlank()

.../vendor/nette/utils/src/Utils/Image.php:292	

  Nette\Utils\Image->crop()

.../app/AdminModule/model/UploadsAdmin.php:152	

  Nette\Utils\Image->resize()

142:    
143:           
144:            } else {
145:    
146:               
147:                $width     = $thumbMaxSize;
148:                $height = round($thumbMaxSize / 1.5);
149:    
150:                
151:                if ($image->width > $image->height) {
152:                    $image->resize($width, $height, Image::EXACT);
153:    
154:               
155:                } else {
156:                    $image->resize($width, $height, Image::EXACT);

ODPOVĚĎ

Ahoj,

musíš ten round upravit aby ti vracel místo float datový typ int takto:

$width = intval(round($thumbMaxSize / 1.5));

Jak se ti článek líbil?

Komentáře (0)

Přidat komentář