fix: improve avatar upload functionality

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
This commit is contained in:
Sami Mazouz 2023-05-20 10:51:26 +01:00
parent 777c304ab7
commit d1059c1cc7
No known key found for this signature in database
5 changed files with 5 additions and 5 deletions

View File

@ -204,7 +204,7 @@ export default class AvatarEditor extends Component {
/**
* After a successful upload/removal, push the updated user data into the
* store, and force a recomputation of the user's avatar color.
* store, and force a re-computation of the user's avatar color.
*
* @param {object} response
* @protected

View File

@ -62,7 +62,7 @@ class UploadFaviconController extends UploadImageController
]);
}
$encodedImage = $this->imageManager->make($file->getStream())->resize(64, 64, function ($constraint) {
$encodedImage = $this->imageManager->make($file->getStream()->getMetadata('uri'))->resize(64, 64, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode('png');

View File

@ -38,7 +38,7 @@ class UploadLogoController extends UploadImageController
*/
protected function makeImage(UploadedFileInterface $file): Image
{
$encodedImage = $this->imageManager->make($file->getStream())->heighten(60, function ($constraint) {
$encodedImage = $this->imageManager->make($file->getStream()->getMetadata('uri'))->heighten(60, function ($constraint) {
$constraint->upsize();
})->encode('png');

View File

@ -87,7 +87,7 @@ class AvatarValidator extends AbstractValidator
}
try {
$this->imageManager->make($file->getStream());
$this->imageManager->make($file->getStream()->getMetadata('uri'));
} catch (NotReadableException $_e) {
$this->raise('image');
}

View File

@ -74,7 +74,7 @@ class UploadAvatarHandler
$this->validator->assertValid(['avatar' => $command->file]);
$image = $this->imageManager->make($command->file->getStream());
$image = $this->imageManager->make($command->file->getStream()->getMetadata('uri'));
$this->events->dispatch(
new AvatarSaving($user, $actor, $image)