mirror of
https://github.com/flarum/core.git
synced 2025-10-19 10:46:06 +02:00
feat: Allow switching the ImageManager driver (#3195)
This commit is contained in:
@@ -28,15 +28,21 @@ class UploadFaviconController extends UploadImageController
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
/**
|
||||
* @var ImageManager
|
||||
*/
|
||||
protected $imageManager;
|
||||
|
||||
/**
|
||||
* @param SettingsRepositoryInterface $settings
|
||||
* @param Factory $filesystemFactory
|
||||
*/
|
||||
public function __construct(SettingsRepositoryInterface $settings, Factory $filesystemFactory, TranslatorInterface $translator)
|
||||
public function __construct(SettingsRepositoryInterface $settings, Factory $filesystemFactory, TranslatorInterface $translator, ImageManager $imageManager)
|
||||
{
|
||||
parent::__construct($settings, $filesystemFactory);
|
||||
|
||||
$this->translator = $translator;
|
||||
$this->imageManager = $imageManager;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,9 +62,7 @@ class UploadFaviconController extends UploadImageController
|
||||
]);
|
||||
}
|
||||
|
||||
$manager = new ImageManager();
|
||||
|
||||
$encodedImage = $manager->make($file->getStream())->resize(64, 64, function ($constraint) {
|
||||
$encodedImage = $this->imageManager->make($file->getStream())->resize(64, 64, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
})->encode('png');
|
||||
|
Reference in New Issue
Block a user