Skip to content

Backport of MAGETWO-53010 for Magento 2.1: Saving a custom transactional email logo, failed. #9590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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