Main.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Copyright © 2015 Magento. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * System config Logo image field backend model
  8. */
  9. namespace Smartwave\Porto\Model\Config\Backend\Image;
  10. class Main extends \Magento\Config\Model\Config\Backend\Image
  11. {
  12. /**
  13. * The tail part of directory path for uploading
  14. *
  15. */
  16. const UPLOAD_DIR = 'porto/main_bg';
  17. /**
  18. * Return path to directory for upload file
  19. *
  20. * @return string
  21. * @throw \Magento\Framework\Exception\LocalizedException
  22. */
  23. protected function _getUploadDir()
  24. {
  25. return $this->_mediaDirectory->getAbsolutePath($this->_appendScopeInfo(self::UPLOAD_DIR));
  26. }
  27. /**
  28. * Makes a decision about whether to add info about the scope.
  29. *
  30. * @return boolean
  31. */
  32. protected function _addWhetherScopeInfo()
  33. {
  34. return true;
  35. }
  36. /**
  37. * Getter for allowed extensions of uploaded files.
  38. *
  39. * @return string[]
  40. */
  41. protected function _getAllowedExtensions()
  42. {
  43. return ['jpg', 'jpeg', 'gif', 'png'];
  44. }
  45. }