Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit adbe01d0 authored by Nicolas's avatar Nicolas
Browse files

Gestion des valeurs de system.xml pour les images

parent ddd3f5c2
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ use \Magento\Framework\App\Filesystem\DirectoryList; ...@@ -7,6 +7,7 @@ use \Magento\Framework\App\Filesystem\DirectoryList;
use \Magento\Framework\Image\AdapterFactory as ImageAdapterFactory; use \Magento\Framework\Image\AdapterFactory as ImageAdapterFactory;
use \Magento\Framework\View\Element\Template; use \Magento\Framework\View\Element\Template;
use \Magento\Framework\View\Element\Template\Context; use \Magento\Framework\View\Element\Template\Context;
use \Magento\Store\Model\ScopeInterface;
use \Magento\Store\Model\StoreManagerInterface; use \Magento\Store\Model\StoreManagerInterface;
use \Magento\Widget\Block\BlockInterface; use \Magento\Widget\Block\BlockInterface;
...@@ -86,18 +87,7 @@ class Image extends Template implements BlockInterface ...@@ -86,18 +87,7 @@ class Image extends Template implements BlockInterface
* if keepAspectRatio(false). * if keepAspectRatio(false).
* - backgroundColor[null]: Default white * - backgroundColor[null]: Default white
*/ */
protected $defaultSettings = [ protected $defaultSettings = [];
'constrainOnly' => true,
'keepAspectRatio' => true,
'keepTransparency' => true,
'keepFrame' => false,
'backgroundColor' => null,
'identifier' => 'mmi',
'basename' => '',
'width' => 1920,
'height' => 1080,
'compression' => 60
];
/** /**
* @var ImageOptimizer * @var ImageOptimizer
...@@ -144,6 +134,19 @@ class Image extends Template implements BlockInterface ...@@ -144,6 +134,19 @@ class Image extends Template implements BlockInterface
$this->imageOptimizer = $imageOptimizer; $this->imageOptimizer = $imageOptimizer;
parent::__construct($context, $data); parent::__construct($context, $data);
$this->defaultSettings = [
'constrainOnly' => $this->_scopeConfig->getValue('mediamangerimage/resize/constrain_only', ScopeInterface::SCOPE_STORE),
'keepAspectRatio' => $this->_scopeConfig->getValue('mediamangerimage/resize/keep_aspect_ratio', ScopeInterface::SCOPE_STORE),
'keepTransparency' => $this->_scopeConfig->getValue('mediamangerimage/resize/keep_transparency', ScopeInterface::SCOPE_STORE),
'keepFrame' => $this->_scopeConfig->getValue('mediamangerimage/resize/keep_frame', ScopeInterface::SCOPE_STORE),
'backgroundColor' => $this->_scopeConfig->getValue('mediamangerimage/resize/background_color', ScopeInterface::SCOPE_STORE),
'identifier' => $this->_scopeConfig->getValue('mediamangerimage/save/identifier', ScopeInterface::SCOPE_STORE),
'basename' => $this->_scopeConfig->getValue('mediamangerimage/save/basename', ScopeInterface::SCOPE_STORE),
'width' => $this->_scopeConfig->getValue('mediamangerimage/save/width', ScopeInterface::SCOPE_STORE),
'height' => $this->_scopeConfig->getValue('mediamangerimage/save/height', ScopeInterface::SCOPE_STORE),
'compression' => $this->_scopeConfig->getValue('mediamangerimage/save/compression', ScopeInterface::SCOPE_STORE)
];
} }
/** /**
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<system> <system>
<section id="mediamanagerimage" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <section id="mediamanagerimage" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class> <class>separator-top</class>
<label>Media Manager Image (Not Working Yet)</label> <label>Media Manager Image</label>
<tab>nicolasbejean</tab> <tab>nicolasbejean</tab>
<resource>NicolasBejean_MediaManager::image</resource> <resource>NicolasBejean_MediaManager::image</resource>
<group id="resize" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <group id="resize" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment