fix crop issue with server avatar image upload

This commit is contained in:
Joseph D'Souza 2026-02-11 12:59:40 +01:00
parent 51064d95e3
commit d7e30ce781

View File

@ -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());