FEATURE: add input for setting preview size and quality
This commit is contained in:
@@ -15,6 +15,7 @@ class SettingExtension
|
||||
* @var string view used for rendering given settings part
|
||||
*/
|
||||
protected $view;
|
||||
protected $order;
|
||||
|
||||
/**
|
||||
* SettingExtension constructor.
|
||||
@@ -23,11 +24,12 @@ class SettingExtension
|
||||
* @param string $name
|
||||
* @param string $view
|
||||
*/
|
||||
public function __construct($id, $name, $view)
|
||||
public function __construct($id, $name, $view, $order)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->name = $name;
|
||||
$this->view = $view;
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,4 +55,14 @@ class SettingExtension
|
||||
{
|
||||
return $this->view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\CMS\Handlers\Registrators;
|
||||
|
||||
use App\CMS\Enumerations\Exceptions\EnumerationExistsException;
|
||||
use App\CMS\Exceptions\Enumerations\EnumerationExistsException;
|
||||
use App\CMS\Handlers\Registrators\Items\SettingExtension;
|
||||
|
||||
class SettingsExtensionRegistrator
|
||||
@@ -22,12 +23,16 @@ class SettingsExtensionRegistrator
|
||||
*
|
||||
* @throws EnumerationExistsException
|
||||
*/
|
||||
public function register($sectionId, $sectionName, $sectionView)
|
||||
public function register($sectionId, $sectionName, $sectionView, $order = null)
|
||||
{
|
||||
$this->checkIfRegistered($sectionId);
|
||||
|
||||
if (is_null($order)) {
|
||||
$order = count($this->settingsExtensions);
|
||||
}
|
||||
|
||||
// register new extension
|
||||
$this->settingsExtensions[$sectionId] = new SettingExtension($sectionId, $sectionName, $sectionView);
|
||||
$this->settingsExtensions[$sectionId] = new SettingExtension($sectionId, $sectionName, $sectionView, $order);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,14 +49,15 @@ class SettingsExtensionRegistrator
|
||||
|
||||
/**
|
||||
* Getter for all registered extensions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
// sort registered extensions by key
|
||||
ksort($this->settingsExtensions);
|
||||
|
||||
// sort registered extensions
|
||||
uasort($this->settingsExtensions, function (SettingExtension $a, SettingExtension $b) {
|
||||
return $a->getOrder() - $b->getOrder();
|
||||
});
|
||||
|
||||
return $this->settingsExtensions;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,6 @@ class CreateImageThumbnail implements ShouldQueue
|
||||
});
|
||||
|
||||
// save thumbnail with lower quality
|
||||
$image->save(config('app.thumbnail_path') . DIRECTORY_SEPARATOR . $file->getFilename(), 75);
|
||||
$image->save(config('app.thumbnail_path') . DIRECTORY_SEPARATOR . $file->getFilename(), setting('previewQuality', 75));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
$registrator->register('basic', 'admin/settings.basic', 'admin.settings.parts.basic');
|
||||
$registrator->register('meta', 'admin/settings.meta', 'admin.settings.parts.meta');
|
||||
$registrator->register('social', 'admin/settings.socialSites', 'admin.settings.parts.social');
|
||||
$registrator->register('widgets', 'admin/settings.widgets.title', 'admin.settings.parts.widgets');
|
||||
$registrator->register('advanced', 'admin/settings.advanced.title', 'admin.settings.parts.advanced', 999);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user