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

[BUG] Phalcon\Image::crop() half params must be int, half can be int or float. #2259

Closed
liesislukas opened this issue Mar 29, 2014 · 2 comments
Labels
bug A bug report status: medium Medium

Comments

@liesislukas
Copy link

I just had very bad morning of not knowing, that this function requires integers for offsets. I had floats.. I think it should be done in next release, that you could use floats or integers for all 4 params, or at least throw exceptions, docs written or something.

I use Phalcon 1.3.1 my final solution:

// i'm rounding those coordinates and they all become integer-like floats.
$x = round($x);
$y = round($y);
$w = round($w);
$h = round($h);
$uploaded_image->crop($w, $h, (int)$x, (int)$y);

my $x and $y comes in float, even if they are integer-like (value of $x is 0,1,2,3...) it still has float type and i was not able to use it. I had no errors, no nothing, just not working. It's PHP, we should be able to use int, float or even string with numbers - any numeric value in such situations.

Oh, and $w and $h are floats too, but it's all good, so i think it's definitely a bug, that half params are working with floats, some with only int, but no errors about it.

p.s. have't tried other numeric values like $x = '1';

@dreamsxin
Copy link
Contributor

I try change it.

@liesislukas
Copy link
Author

thanks ;)

@phalcon phalcon closed this as completed in 305b0cf Jun 4, 2014
@phalcon phalcon changed the title [BUG] Phalcon\Image::crop() half params must be int, half can be int or float. [BUG] Phalcon\Image::crop() half params must be int, half can be int or float. Sep 10, 2014
@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

3 participants