mirror of
https://github.com/flarum/framework.git
synced 2025-01-20 19:15:32 +08:00
fix: improve avatar upload functionality
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
This commit is contained in:
parent
777c304ab7
commit
d1059c1cc7
|
@ -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
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user