mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Fixed image blur
This commit is contained in:
parent
ea30bebdaf
commit
413817d77e
@ -7,8 +7,6 @@ use Yii;
|
||||
/**
|
||||
* FileSettingsForm
|
||||
* @property integer $maxFileSize
|
||||
* @property integer $maxPreviewImageWidth
|
||||
* @property integer $maxPreviewImageHeight
|
||||
* @property integer $excludeMediaFilesPreview Exclude media files from stream attachment list
|
||||
* @property integer $useXSendfile
|
||||
* @property string $allowedExtensions
|
||||
@ -19,8 +17,6 @@ class FileSettingsForm extends \yii\base\Model
|
||||
{
|
||||
|
||||
public $maxFileSize;
|
||||
public $maxPreviewImageWidth;
|
||||
public $maxPreviewImageHeight;
|
||||
public $excludeMediaFilesPreview;
|
||||
public $useXSendfile;
|
||||
public $allowedExtensions;
|
||||
@ -35,8 +31,6 @@ class FileSettingsForm extends \yii\base\Model
|
||||
$settingsManager = Yii::$app->getModule('file')->settings;
|
||||
|
||||
$this->maxFileSize = $settingsManager->get('maxFileSize') / 1024 / 1024;
|
||||
$this->maxPreviewImageWidth = $settingsManager->get('maxPreviewImageWidth');
|
||||
$this->maxPreviewImageHeight = $settingsManager->get('maxPreviewImageHeight');
|
||||
$this->excludeMediaFilesPreview = $settingsManager->get('excludeMediaFilesPreview');
|
||||
$this->useXSendfile = $settingsManager->get('useXSendfile');
|
||||
$this->allowedExtensions = $settingsManager->get('allowedExtensions');
|
||||
@ -49,7 +43,7 @@ class FileSettingsForm extends \yii\base\Model
|
||||
{
|
||||
return [
|
||||
[['allowedExtensions'], 'match', 'pattern' => '/^[A-Za-z0-9_,]+$/u'],
|
||||
[['maxFileSize', 'useXSendfile', 'maxPreviewImageWidth', 'maxPreviewImageHeight', 'excludeMediaFilesPreview'], 'integer'],
|
||||
[['maxFileSize', 'useXSendfile', 'excludeMediaFilesPreview'], 'integer'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -61,8 +55,6 @@ class FileSettingsForm extends \yii\base\Model
|
||||
return [
|
||||
'maxFileSize' => Yii::t('AdminModule.settings', 'Maximum upload file size (in MB)'),
|
||||
'useXSendfile' => Yii::t('AdminModule.settings', 'Use X-Sendfile for File Downloads'),
|
||||
'maxPreviewImageWidth' => Yii::t('AdminModule.settings', 'Maximum preview image width (in pixels, optional)'),
|
||||
'maxPreviewImageHeight' => Yii::t('AdminModule.settings', 'Maximum preview image height (in pixels, optional)'),
|
||||
'excludeMediaFilesPreview' => Yii::t('AdminModule.settings', 'Exclude media files from stream attachment list'),
|
||||
'allowedExtensions' => Yii::t('AdminModule.settings', 'Allowed file extensions'),
|
||||
];
|
||||
@ -78,8 +70,6 @@ class FileSettingsForm extends \yii\base\Model
|
||||
{
|
||||
$settingsManager = Yii::$app->getModule('file')->settings;
|
||||
$settingsManager->set('maxFileSize', $this->maxFileSize * 1024 * 1024);
|
||||
$settingsManager->set('maxPreviewImageWidth', $this->maxPreviewImageWidth);
|
||||
$settingsManager->set('maxPreviewImageHeight', $this->maxPreviewImageHeight);
|
||||
$settingsManager->set('excludeMediaFilesPreview', $this->excludeMediaFilesPreview);
|
||||
$settingsManager->set('useXSendfile', $this->useXSendfile);
|
||||
$settingsManager->set('allowedExtensions', strtolower($this->allowedExtensions));
|
||||
|
@ -38,18 +38,6 @@ $fileModule = Yii::$app->getModule('file');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<?= $form->labelEx($model, 'maxPreviewImageWidth'); ?>
|
||||
<?= $form->textField($model, 'maxPreviewImageWidth', ['class' => 'form-control', 'readonly' => $fileModule->settings->isFixed('maxPreviewImageWidth')]); ?>
|
||||
<p class="help-block"><?= Yii::t('AdminModule.settings', 'If not set, width will default to 200px.') ?></p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<?= $form->labelEx($model, 'maxPreviewImageHeight'); ?>
|
||||
<?= $form->textField($model, 'maxPreviewImageHeight', ['class' => 'form-control', 'readonly' => $fileModule->settings->isFixed('maxPreviewImageHeight')]); ?>
|
||||
<p class="help-block"><?= Yii::t('AdminModule.settings', 'If not set, height will default to 200px.') ?></p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
|
@ -76,4 +76,16 @@ class Module extends \humhub\components\Module
|
||||
* @var int The WebP quality for uploaded WebP files. From 0 to 100.
|
||||
*/
|
||||
public $imageWebpQuality = null;
|
||||
|
||||
/**
|
||||
* @since 1.7
|
||||
* @var int The maximum height of generated preview image files in px.
|
||||
*/
|
||||
public $imagePreviewMaxHeight = 400;
|
||||
|
||||
/**
|
||||
* @since 1.7
|
||||
* @var int The maximum width of generated preview image files in px.
|
||||
*/
|
||||
public $imagePreviewMaxWidth = 400;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
namespace humhub\modules\file\converter;
|
||||
|
||||
use humhub\modules\file\libs\ImageHelper;
|
||||
use humhub\modules\file\Module;
|
||||
use Imagine\Image\ImageInterface;
|
||||
use Yii;
|
||||
use humhub\modules\file\models\File;
|
||||
@ -40,11 +41,11 @@ class PreviewImage extends BaseConverter
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$maxPreviewImageWidth = Yii::$app->getModule('file')->settings->get('maxPreviewImageWidth');
|
||||
$maxPreviewImageHeight = Yii::$app->getModule('file')->settings->get('maxPreviewImageHeight');
|
||||
/** @var Module $module */
|
||||
$module = Yii::$app->getModule('file');
|
||||
|
||||
$this->options['width'] = $maxPreviewImageWidth ? $maxPreviewImageWidth : 200;
|
||||
$this->options['height'] = $maxPreviewImageHeight ? $maxPreviewImageHeight : 200;
|
||||
$this->options['width'] = $module->imagePreviewMaxWidth;
|
||||
$this->options['height'] = $module->imagePreviewMaxHeight;
|
||||
|
||||
parent::init();
|
||||
}
|
||||
|
@ -51,8 +51,6 @@ class InitialData
|
||||
|
||||
// File
|
||||
Yii::$app->getModule('file')->settings->set('maxFileSize', '1048576' * 5);
|
||||
Yii::$app->getModule('file')->settings->set('maxPreviewImageWidth', '200');
|
||||
Yii::$app->getModule('file')->settings->set('maxPreviewImageHeight', '200');
|
||||
Yii::$app->getModule('file')->settings->set('excludeMediaFilesPreview', '1');
|
||||
|
||||
// Caching
|
||||
|
Loading…
x
Reference in New Issue
Block a user