Skip to content

Commit

Permalink
MAGETWO-53010: [Email Logo] Saving a custom transactional email logo,…
Browse files Browse the repository at this point in the history
… failed.
  • Loading branch information
Oleksandr Karpenko committed Jun 7, 2016
1 parent 3fbefa4 commit 23103c0
Show file tree
Hide file tree
Showing 5 changed files with 39 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 © 2016 Magento. 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'];
}
}
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 23103c0

Please sign in to comment.