28

I'm trying to change transactional email logo from.

Admin > Content > Design > Configuration > Edit any record -> Transactional Emails

It's on Magento 2.1 but logo showing broken image after save. please refer attached screen shot.

enter image description here

5
  • 1
    Image is not found so it show their . right click and Inspect element show image page and check it .may be you find solution Jul 30 '16 at 9:37
  • 1
    after inspect element is showing /pub/media/email/logo/stores/1/email_logo.png but currently email logo saved in directory /pub/media/logo/websites/1/email_logo.png Jul 30 '16 at 9:46
  • 1
    I feel that it's bug in Magento 2.1 Jul 30 '16 at 19:17
  • 1
    I am still facing this issue in Magento 2.1.3. Is there any solution other than changing in core files??
    – BornCoder
    Jan 13 '17 at 12:33
  • Running latest version of 2.2.6 this is still a problem. I tried manually creating the dirs and files with absolutely no success. It is beyond ridiculous that devs at magento have not solved some of the most basic CMS 101 features. Dec 9 '18 at 9:41

10 Answers 10

9

I also encountered this problem, and made a temporary solution :

I checked Magento/Config/Model/Config/Backend/Email/Logo and find this constant:

const UPLOAD_DIR = 'email/logo';

and changed it to:

const UPLOAD_DIR = 'logo';

also in Magento/Email/etc/di.xml, I replaced email/logo with just logo:

<item name="value" xsi:type="string">email/logo</item>

to:

<item name="value" xsi:type="string">logo</item>
2
  • It's working but it will not reflect on the emails
    – Rajan Soni
    Feb 23 '18 at 10:20
  • It's working but it will not reflect on the emails Same.any idea? Mar 21 '18 at 10:42
9

The easiest work around without modifying code is to

1) create the directory pub/media/email/logo/default or pub/media/email/logo/stores/1/ (works on 2.1.2)

2) copy the logo to the directory manually.

3) Then via the correct procedure Content > Design > Configuration > Edit > Transnational emails >

Now upload the same logo you you manually added to the newly created directory.

5
  • THIS IS STILL A PROBLEM IN VERSION 2.1.7 !!!
    – styzzz
    Jul 24 '17 at 22:11
  • this solution was surprisingly effective (remember to set the permissions) May 31 '18 at 7:44
  • its not working for me Jun 23 '18 at 16:44
  • @ErSarveshVTiwari I had directory path for 2.1.2 version - It's work with your version ? Can you specifiy your version in response please
    – Nolwennig
    Nov 5 '18 at 16:12
  • @styzzz I had directory path for 2.1.2 version - It's work with your 2.1.7 version ?
    – Nolwennig
    Nov 5 '18 at 16:12
3

This is a bug in 2.1.2 and lower. After uploading the image, it goes to the wrong directory at pub/media/email/logo/websites/1/

It should be pub/media/logo/websites/1/

File ref: app/code/Magento/Email/Model/AbstractTemplate.php

It's not yet included in the latest 2.1.2. You can just upload the image in the correct directory while waiting for the fix to be implemented in the next release.

2

This workaround worked for me:

Add a file named logo_email.png to a Magento_Email/web directory in your custom theme:

app/design/frontend/Vendor/yourtheme/Magento_Email/web directory

Copy the

<Magento_Email_module_dir>/view/frontend/email/header.html

file into a Magento_Email/email directory in your theme.

Edit the width and height attributes of the tag to reflect the area in which you want your logo to display (for example, 200 × 100).

Example:

{{if logo_width}}
    width="{{var logo_width}}"
{{else}}
    width="200"
{{/if}}

{{if logo_height}}
    height="{{var logo_height}}"
{{else}}
    height="100"
{{/if}}

You should leave the if/else conditional statement in place in case you ever want to override these values using the Admin.

2

If the issue is occurring in 2.3.0

For Email logo : Replace fileUploader to imageUploader in

vendor/magento/module-email/view/adminhtml/ui_component/design_config_form.xml

<field name="email_logo" formElement="imageUploader">

For Site logo : Replace fileUploader to imageUploader in

vendor/magento/module-theme/view/adminhtml/ui_component/design_config_form.xml

 <field name="head_shortcut_icon" formElement="imageUploader">

&

<field name="header_logo_src" formElement="imageUploader">
1

The bug is still alive! Follow these steps to correct it:

  • create di.xml into you custom module
  • add <preference for="Magento\Theme\Model\Design\Backend\Logo" type="Vendor\YouModuleName\Model\Design\Backend\Logo"/>
  • create the file Vendor\YouModuleName\Model\Design\Backend\Logo.php
  • replace the const UPLOAD_DIR = 'logo'; with const UPLOAD_DIR = 'email/logo';
  • Test it! ;)
1

Open the new email template, load any template and click on Preview. After preview click on the logo. It will show the path where Magento picks it. Go to the path, delete previous logo and upload. Your problem will be solved.

1

Magento fixed the bug in 2.2.6 version.

https://github.com/magento/magento2/commit/23103c03c527fe1ed3e1a3be691436818b7963fe#diff-6b96f29ad945c7cea90267bd4f533218L12

Here you have theire commit.

8
  • Is this fixed in 2.1? I have updated my 2.1 installation with composer but it doesn't seem to be fixed. How can we update?
    – cha
    Sep 19 '16 at 5:20
  • I don't know if it's fixed now. I make the change manually. Sep 19 '16 at 11:56
  • 1
    It's not yet fixed as of 2.1.2.
    – jehzlau
    Nov 8 '16 at 1:07
  • 1
    It's not yet fixed in 2.1.3 also.
    – BornCoder
    Jan 13 '17 at 12:34
  • 1
    Not fixed in 2.1.4, complete joke. Jul 7 '17 at 10:56
0

My solution for this bug.
1. Copy this module to app/code/Icube/EmailLogo
2. php bin/magento setup:upgrade
Deploy and clean cache.
https://github.com/quannh02/EmailLogoMagento2.1

0

Following is a simple work around. No need to change the file structure, etc.

First, create a static block with an image of your logo. Add the necessary texts if you want.
Name the static block email-logo.
Insert the block in the html of your email template like this:

{{block class="Magento\Cms\Block\Block" area='frontend' block_id="email-logo"}}

You can now remove the default email header from your email:

{{template config_path="design/email/header_template"}}

Not the answer you're looking for? Browse other questions tagged or ask your own question.