-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
- Loading branch information
Showing
28 changed files
with
621 additions
and
96 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
app/code/Magento/Backend/Block/DataProviders/ImageUploadConfig.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Backend\Block\DataProviders; | ||
|
||
use Magento\Framework\View\Element\Block\ArgumentInterface; | ||
use Magento\Backend\Model\Image\UploadResizeConfigInterface; | ||
|
||
/** | ||
* Provides additional data for image uploader | ||
*/ | ||
class ImageUploadConfig implements ArgumentInterface | ||
{ | ||
/** | ||
* @var UploadResizeConfigInterface | ||
*/ | ||
private $imageUploadConfig; | ||
|
||
/** | ||
* @param UploadResizeConfigInterface $imageUploadConfig | ||
*/ | ||
public function __construct(UploadResizeConfigInterface $imageUploadConfig) | ||
{ | ||
$this->imageUploadConfig = $imageUploadConfig; | ||
} | ||
|
||
/** | ||
* Get image resize configuration | ||
* | ||
* @return int | ||
*/ | ||
public function getIsResizeEnabled(): int | ||
{ | ||
return (int)$this->imageUploadConfig->isResizeEnabled(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
app/code/Magento/Backend/Model/Image/UploadResizeConfig.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Backend\Model\Image; | ||
|
||
/** | ||
* Image uploader config provider. | ||
*/ | ||
class UploadResizeConfig implements UploadResizeConfigInterface | ||
{ | ||
/** | ||
* Config path for the maximal image width value | ||
*/ | ||
const XML_PATH_MAX_WIDTH_IMAGE = 'system/upload_configuration/max_width'; | ||
|
||
/** | ||
* Config path for the maximal image height value | ||
*/ | ||
const XML_PATH_MAX_HEIGHT_IMAGE = 'system/upload_configuration/max_height'; | ||
|
||
/** | ||
* Config path for the maximal image height value | ||
*/ | ||
const XML_PATH_ENABLE_RESIZE = 'system/upload_configuration/enable_resize'; | ||
|
||
/** | ||
* @var \Magento\Framework\App\Config\ScopeConfigInterface | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config | ||
*/ | ||
public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $config) | ||
{ | ||
$this->config = $config; | ||
} | ||
|
||
/** | ||
* Get maximal width value for resized image | ||
* | ||
* @return int | ||
*/ | ||
public function getMaxWidth(): int | ||
{ | ||
return (int)$this->config->getValue(self::XML_PATH_MAX_WIDTH_IMAGE); | ||
} | ||
|
||
/** | ||
* Get maximal height value for resized image | ||
* | ||
* @return int | ||
*/ | ||
public function getMaxHeight(): int | ||
{ | ||
return (int)$this->config->getValue(self::XML_PATH_MAX_HEIGHT_IMAGE); | ||
} | ||
|
||
/** | ||
* Get config value for frontend resize | ||
* | ||
* @return bool | ||
*/ | ||
public function isResizeEnabled(): bool | ||
{ | ||
return (bool)$this->config->getValue(self::XML_PATH_ENABLE_RESIZE); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
app/code/Magento/Backend/Model/Image/UploadResizeConfigInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Backend\Model\Image; | ||
|
||
/** | ||
* Interface UploadResizeConfigInterface | ||
* | ||
* Used to retrieve configuration for frontend image uploader | ||
*/ | ||
interface UploadResizeConfigInterface | ||
{ | ||
/** | ||
* Get maximal width value for resized image | ||
* | ||
* @return int | ||
*/ | ||
public function getMaxWidth(): int; | ||
|
||
/** | ||
* Get maximal height value for resized image | ||
* | ||
* @return int | ||
*/ | ||
public function getMaxHeight(): int; | ||
|
||
/** | ||
* Get config value for frontend resize | ||
* | ||
* @return bool | ||
*/ | ||
public function isResizeEnabled(): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.