use intval() instead of floor() for int return type
This commit is contained in:
parent
49a7cb9d84
commit
7f3611c51c
|
@ -369,7 +369,7 @@ class AvatarsettingsAction extends SettingsAction
|
||||||
$dest_y = $this->arg('avatar_crop_y') ? $this->arg('avatar_crop_y'):0;
|
$dest_y = $this->arg('avatar_crop_y') ? $this->arg('avatar_crop_y'):0;
|
||||||
$dest_w = $this->arg('avatar_crop_w') ? $this->arg('avatar_crop_w'):$file_d;
|
$dest_w = $this->arg('avatar_crop_w') ? $this->arg('avatar_crop_w'):$file_d;
|
||||||
$dest_h = $this->arg('avatar_crop_h') ? $this->arg('avatar_crop_h'):$file_d;
|
$dest_h = $this->arg('avatar_crop_h') ? $this->arg('avatar_crop_h'):$file_d;
|
||||||
$size = floor(min($dest_w, $dest_h, MAX_ORIGINAL));
|
$size = intval(min($dest_w, $dest_h, MAX_ORIGINAL));
|
||||||
|
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
$profile = $user->getProfile();
|
$profile = $user->getProfile();
|
||||||
|
|
|
@ -90,8 +90,8 @@ class Avatar extends Managed_DataObject
|
||||||
*/
|
*/
|
||||||
public static function byProfile(Profile $target, $width=null, $height=null)
|
public static function byProfile(Profile $target, $width=null, $height=null)
|
||||||
{
|
{
|
||||||
$width = (int) floor($width);
|
$width = intval($width);
|
||||||
$height = !is_null($height) ? (int) floor($height) : null;
|
$height = !is_null($height) ? intval($height) : null;
|
||||||
if (is_null($height)) {
|
if (is_null($height)) {
|
||||||
$height = $width;
|
$height = $width;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ class Avatar extends Managed_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
static function newSize(Profile $target, $width) {
|
static function newSize(Profile $target, $width) {
|
||||||
$width = (int) floor($width);
|
$width = intval($width);
|
||||||
if ($width < 1 || $width > common_config('avatar', 'maxsize')) {
|
if ($width < 1 || $width > common_config('avatar', 'maxsize')) {
|
||||||
// TRANS: An error message when avatar size is unreasonable
|
// TRANS: An error message when avatar size is unreasonable
|
||||||
throw new Exception(_m('Avatar size too large'));
|
throw new Exception(_m('Avatar size too large'));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user