Config.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Framework\Image\Adapter;
  8. /**
  9. * Image config provider.
  10. */
  11. class Config implements ConfigInterface, UploadConfigInterface
  12. {
  13. const XML_PATH_IMAGE_ADAPTER = 'dev/image/default_adapter';
  14. const XML_PATH_IMAGE_ADAPTERS = 'dev/image/adapters';
  15. /**
  16. * Config path for the maximal image width value
  17. * @deprecated
  18. */
  19. const XML_PATH_MAX_WIDTH_IMAGE = 'system/upload_configuration/max_width';
  20. /**
  21. * Config path for the maximal image height value
  22. * @deprecated
  23. */
  24. const XML_PATH_MAX_HEIGHT_IMAGE = 'system/upload_configuration/max_height';
  25. /**
  26. * @var \Magento\Framework\App\Config\ScopeConfigInterface
  27. */
  28. protected $config;
  29. /**
  30. * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
  31. */
  32. public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $config)
  33. {
  34. $this->config = $config;
  35. }
  36. /**
  37. * {@inherit}
  38. *
  39. * @return string
  40. */
  41. public function getAdapterAlias()
  42. {
  43. return (string)$this->config->getValue(self::XML_PATH_IMAGE_ADAPTER);
  44. }
  45. /**
  46. * {@inherit}
  47. *
  48. * @return mixed
  49. */
  50. public function getAdapters()
  51. {
  52. return $this->config->getValue(self::XML_PATH_IMAGE_ADAPTERS);
  53. }
  54. /**
  55. * Get Maximum Image Width resolution in pixels. For image resizing on client side.
  56. *
  57. * @return int
  58. * @deprecated 102.0.1
  59. * @see \Magento\Backend\Model\Image\UploadResizeConfigInterface::getMaxHeight()
  60. */
  61. public function getMaxWidth(): int
  62. {
  63. return (int)$this->config->getValue(self::XML_PATH_MAX_WIDTH_IMAGE);
  64. }
  65. /**
  66. * Get Maximum Image Height resolution in pixels. For image resizing on client side.
  67. *
  68. * @return int
  69. * @deprecated 102.0.1
  70. * @see \Magento\Backend\Model\Image\UploadResizeConfigInterface::getMaxHeight()
  71. */
  72. public function getMaxHeight(): int
  73. {
  74. return (int)$this->config->getValue(self::XML_PATH_MAX_HEIGHT_IMAGE);
  75. }
  76. }