You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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';
The text was updated successfully, but these errors were encountered:
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
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:
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';
The text was updated successfully, but these errors were encountered: