N°3124 - Refactorize ResizeImageToFit methods (#734)

This commit is contained in:
Timmy38
2025-08-08 10:43:35 +02:00
committed by GitHub
parent 5b9e0a1d4f
commit 71386198cf
7 changed files with 227 additions and 190 deletions

View File

@@ -433,9 +433,10 @@ class UserProfileBrickController extends BrickController
$oCurContact = UserRights::GetContactObject();
// Resizing image
$oAttDef = MetaModel::GetAttributeDef(get_class($oCurContact), $sPictureAttCode);
$aSize = utils::GetImageSize($oImage->GetData());
$oImage = utils::ResizeImageToFit($oImage, $aSize[0], $aSize[1], $oAttDef->Get('storage_max_width'),
$oAttDef->Get('storage_max_height'));
$oImage = $oImage->ResizeImageToFit(
$oAttDef->Get('storage_max_width'),
$oAttDef->Get('storage_max_height')
);
// Setting it to the contact
$oCurContact->Set($sPictureAttCode, $oImage);
// Forcing allowed writing on the object if necessary.