Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleImage: Implicit Conversion from float to int #14

Open
juppwerner opened this issue Oct 4, 2023 · 0 comments
Open

SimpleImage: Implicit Conversion from float to int #14

juppwerner opened this issue Oct 4, 2023 · 0 comments

Comments

@juppwerner
Copy link

It may happen that components/SimpleImage::resize gets called with float arguments for width or height.

The following image... methods called in the resize() method may throw the error:
yii\base\ErrorException: Implicit conversion from float nnnn.nn to int loses precision in /var/www/html/vendor/floor12/yii2-module-files/src/components/SimpleImage.php:99 (or elsewhere).

Simple fix maybe:

function resize($width, $height)
{
$width = round($width, 0);
$height = round($height, 0);

Thank you for this great extension!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant