Skip to content

Commit

Permalink
MAGETWO-69062: Backport of MAGETWO-53010 for Magento 2.1: Saving a cu…
Browse files Browse the repository at this point in the history
…stom transactional email logo, failed. #9590
  • Loading branch information
Oleksii Korshenko authored May 15, 2017
2 parents 0a8ee90 + 1518c1b commit f7f6c1f
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/code/Magento/Config/Model/Config/Backend/Email/Logo.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
*/
namespace Magento\Config\Model\Config\Backend\Email;

/**
* @deprecated
*/
class Logo extends \Magento\Config\Model\Config\Backend\Image
{
/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Email/Model/AbstractTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ protected function getLogoUrl($store)
$store
);
if ($fileName) {
$uploadDir = \Magento\Config\Model\Config\Backend\Email\Logo::UPLOAD_DIR;
$uploadDir = \Magento\Email\Model\Design\Backend\Logo::UPLOAD_DIR;
$mediaDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA);
if ($mediaDirectory->isFile($uploadDir . '/' . $fileName)) {
return $this->storeManager->getStore()->getBaseUrl(
Expand Down
33 changes: 33 additions & 0 deletions app/code/Magento/Email/Model/Design/Backend/Logo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Email\Model\Design\Backend;

use Magento\Theme\Model\Design\Backend\Logo as DesignLogo;

class Logo extends DesignLogo
{
/**
* The tail part of directory path for uploading
*/
const UPLOAD_DIR = 'email/logo';

/**
* Upload max file size in kilobytes
*
* @var int
*/
protected $maxFileSize = 2048;

/**
* Getter for allowed extensions of uploaded files
*
* @return string[]
*/
public function getAllowedExtensions()
{
return ['jpg', 'jpeg', 'gif', 'png'];
}
}
1 change: 1 addition & 0 deletions app/code/Magento/Email/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "N/A",
"require": {
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-theme": "100.1.*",
"magento/module-config": "100.1.*",
"magento/module-store": "100.1.*",
"magento/module-cms": "101.0.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Email/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<item name="email_logo" xsi:type="array">
<item name="path" xsi:type="string">design/email/logo</item>
<item name="fieldset" xsi:type="string">other_settings/email</item>
<item name="backend_model" xsi:type="string">Magento\Theme\Model\Design\Backend\Logo</item>
<item name="backend_model" xsi:type="string">Magento\Email\Model\Design\Backend\Logo</item>
<item name="base_url" xsi:type="array">
<item name="type" xsi:type="string">media</item>
<item name="scope_info" xsi:type="string">1</item>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Theme/Model/Design/Backend/Logo.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Logo extends Image
*/
protected function _getUploadDir()
{
return $this->_mediaDirectory->getRelativePath($this->_appendScopeInfo(self::UPLOAD_DIR));
return $this->_mediaDirectory->getRelativePath($this->_appendScopeInfo(static::UPLOAD_DIR));
}

/**
Expand Down

0 comments on commit f7f6c1f

Please sign in to comment.