如何在Mailchimp模板中保留图像尺寸 [英] How to retain image dimensions in Mailchimp templates

查看:252
本文介绍了如何在Mailchimp模板中保留图像尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mailchimp中创建一个模板来发送通讯。该模板包含一个具有前缀大小的图像的可重复部分。由于某种原因,它从img元素中剥离width =和height =,并且仅在每个图像的图像设置中手动设置它们才包括它们。这意味着如果用户上传不同大小的图像,而不是手动输入正确的尺寸,那么在Outlook中,图像将显示为全尺寸。



较少用户友好的设计编辑器,它使用宽/高css样式来显示图像大小是什么,所以它说(例如)350像素宽,高234像素,你可以上传一个更大的图像,它显示为350px宽(这将使用户认为是正确的)。但是它不包括html img width / height值,除非您手动指定它们,这意味着图像大小在Outlook中是错误的。



有没有人知道反正强制最少要自动包含在img元素中的html width变量?否则用户必须手动为每个图像手动设置相同的宽度/高度,如果他们忘记了它将无法在Outlook中正确显示



谢谢,



Dave

解决方案

对于其他参考,我现在已经用mailchimp和 https:// www。 snip2code.com/Snippet/25348/HTML-Email-Template--max-width-hack-for- (下)和img的max-width / max-height css值修复了outlook中的问题:

 <! -  [if(gte mso 9)|(IE)]> 
< center>
< table>
< tr>
< td width =600>
<![endif] - >
< div style =max-width:600px; margin:0 auto;>
< p>即使在不支持最大宽度CSS< / p>的Outlook上,此文本将居中并限制为600像素
< / div>
<! - [if mso]>
< / td>
< / tr>
< / table>
< / center>
<![endif] - >


I'm creating a template in Mailchimp to send out newsletters. The template contains a repeatable section with an image of a prefixed size. For some reason it strips the width="" and height="" values from the img element and only includes them if you manually set these within the image settings for each image. This means if a user uploads an image of a different size and doesn't manually enter the correct dimensions then in Outlook the image displays as full size.

To make it even less user friendly on the design editor it uses the width/height css styles to show what the image size is, so it says (for example) 350px wide by 234px tall and you can upload a much larger image and it shows it at 350px width (which would make a user think it was correct). However it does not include the html img width/height values unless you manually specify them which means the image size is wrong in Outlook.

Does anyone know of anyway to force at least the html width variable to be automatically included in the img element? Otherwise users have to manually set the same width/height for each image manually and if they forget then it will not display correctly in Outlook?

Thanks,

Dave

解决方案

For others reference I have now spoken to mailchimp and using a combination of the code at https://www.snip2code.com/Snippet/25348/HTML-Email-Template--max-width-hack-for- (below) and max-width/max-height css values for the img fixes the problem in outlook:

<!--[if (gte mso 9)|(IE)]>
<center>
  <table>
    <tr>
      <td width="600">
        <![endif]-->
        <div style="max-width: 600px; margin: 0 auto;">
          <p>This text will be centered and constrained to 600 pixels even on Outlook which does not support max-width CSS</p>
        </div>
        <!--[if mso]>
      </td>
    </tr>
  </table>
</center>
<![endif]-->

这篇关于如何在Mailchimp模板中保留图像尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆