fix crop issue with server avatar image upload
This commit is contained in:
parent
51064d95e3
commit
d7e30ce781
@ -11,9 +11,8 @@ use Intervention\Image\ImageManager;
|
||||
|
||||
class UserAvatarManager
|
||||
{
|
||||
const AVATAR_WIDTH = 160;
|
||||
|
||||
const AVATAR_HEIGHT = 160;
|
||||
const AVATAR_WIDTH = 500;
|
||||
const AVATAR_HEIGHT = 500;
|
||||
|
||||
/**
|
||||
* @var User
|
||||
@ -119,9 +118,11 @@ class UserAvatarManager
|
||||
$image->crop($size, $size, (int) $points['x1'], (int) $points['y1'])
|
||||
->resize(self::AVATAR_WIDTH, self::AVATAR_HEIGHT);
|
||||
} else {
|
||||
// If crop points are not provided, we will just crop
|
||||
// provided image to specified width and height.
|
||||
$image->crop(self::AVATAR_WIDTH, self::AVATAR_HEIGHT);
|
||||
// If crop points are not provided, we will just resize maintaining aspect ratio.
|
||||
$image->resize(self::AVATAR_WIDTH, self::AVATAR_HEIGHT, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
});
|
||||
}
|
||||
|
||||
$fileName = $file->hashName($this->getDestinationDirectory());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user