Magento 2.1电子邮件徽标图像功能不起作用,上传后图像损坏



步骤 :1.转到Magento管理员。2. 在路径中上传电子邮件徽标 内容 ->配置 -> 事务性电子邮件 ->徽标图像3. 保存

预期成果 -新电子邮件徽标应显示在新订单 (ALL( 电子邮件中

实际结果 -徽标图像 URL 在路径内容 -> 配置 -> 事务电子邮件 ->徽标图像下的预览中损坏。

由于文件夹权限,基本上您需要为文件夹 777 授予适当的权限,因此会出现此问题。您也可以通过检查元素进行检查,目录中没有图像。希望这个答案适合你。

这是已知问题。

最好的解决方案是使用主题上传您的徽标:

  1. 替换名为logo_email.png位于的徽标:

    app/design/frontend/[themeVendor]/[theme]/Magento_Email/web/logo_email.png

  2. 打开文件头.html位于:

    app/design/frontend/[themeVendor]/[theme]/Magento_Email/email/header.html

  3. 编辑徽标的宽度高度属性

{{if logo_width}}
   width="{{var logo_width}}"
{{else}}
   width="200"
{{/if}}
{{if logo_height}}
   height="{{var logo_height}}"
{{else}}
   height="100"
{{/if}}

得到了这个问题的解决方案:

我创建了一个自定义模块(Ct_EmailLogo(,它覆盖了Magento\主题\模型\设计\后端\徽标所以基本上,我们需要两个主要文件:

    \
  1. app\code\Ct\EmailLogo\etc\di.xml

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="MagentoThemeModelDesignBackendLogo" type="IdsEmailLogoModelDesignBackendLogo"/> </config>

    \
  1. app\code\Ids\EmailLogo\Model\Design\Backend\Logo.php

命名空间 Ids\EmailLogo\Model\Design\Backend;

类徽标扩展\Magento\主题\模型\设计\后端\徽标{

/**
 * The tail part of directory path for uploading
 *
 */
const UPLOAD_DIR = 'email/logo';
/**
 * Return path to directory for upload file
 *
 * @return string
 * @throw MagentoFrameworkExceptionLocalizedException
 */
protected function _getUploadDir() {
    return $this->_mediaDirectory->getRelativePath($this->_appendScopeInfo(self::UPLOAD_DIR));
}
/**
 * Makes a decision about whether to add info about the scope.
 *
 * @return boolean
 */
protected function _addWhetherScopeInfo() {
    return true;
}
/**
 * Getter for allowed extensions of uploaded files.
 *
 * @return string[]
 */
public function getAllowedExtensions() {
    return ['jpg', 'jpeg', 'gif', 'png', 'svg'];
}

}

本模块中所需的其他文件将是基本的

\app\code\Ids\

EmailLogo\registration.php 和 \app\code\Ids\EmailLogo\etc\module.xml

就是这样..快乐编码!!:)

对于 magetno 2 电子邮件事务徽标。我们还更改了供应商文件夹中的电子邮件模块。

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

在线号码 16 大约 用这个替换代码

<field name="email_logo" formElement="fileUploader">
replace with 
<field name="email_logo" formElement="imageUploader">

最新更新