1
0
mirror of https://github.com/flarum/core.git synced 2025-10-13 07:54:25 +02:00
Files
php-flarum/src/Api/Controller/UploadLogoController.php
2020-12-01 10:42:05 -05:00

36 lines
824 B
PHP

<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Api\Controller;
use Intervention\Image\Image;
use Intervention\Image\ImageManager;
use Psr\Http\Message\UploadedFileInterface;
class UploadLogoController extends UploadImageController
{
protected $filePathSettingKey = 'logo_path';
protected $filenamePrefix = 'logo';
/**
* {@inheritdoc}
*/
protected function makeImage(UploadedFileInterface $file): Image
{
$manager = new ImageManager();
$encodedImage = $manager->make($file->getStream())->heighten(60, function ($constraint) {
$constraint->upsize();
})->encode('png');
return $encodedImage;
}
}