claviska / SimpleImage

A PHP class that makes working with images and GD as simple as possible.
MIT License
1.38k stars 382 forks source link

Implicit conversion from float 56.25 to int loses precision #335

Open simp-lee opened 9 months ago

simp-lee commented 9 months ago

Version: 4.0.6

The Nginx server error log is as follows:

2023/11/15 10:36:33 [error] 963#0: *267013 FastCGI sent in stderr: "
PHP message: PHP Deprecated:  Implicit conversion from float 187.5 to int loses precision in .../SimpleImage.php on line 1692
PHP message: PHP Deprecated:  Implicit conversion from float 187.5 to int loses precision in .../SimpleImage.php on line 1692
PHP message: PHP Deprecated:  Implicit conversion from float 56.25 to int loses precision in .../SimpleImage.php on line 1692"
while reading response header from upstream, client: ...., server: ....com, 
request: "GET /images/big/1987229534.jpg HTTP/1.1", 
upstream: "fastcgi://unix:/tmp/php-cgi-81.sock:", 
host: "www.....com", referrer: "..."

Please help me take a look at what the issue is.

simp-lee commented 9 months ago

I found the reason. I added an (int)round($somePara) in the parameters of my code to forcefully convert float into an int type, and the problem is solved.