Prevent oversized images in email templates

Mark_Kalamaridi
Level 2

Prevent oversized images in email templates

Hi

Does anyone know of a good way to handle situations where someone inadvertently 

inserts an oversized image into an email through the mktoImg ImagePicker?
Even though I have a max-width hard-coded and locked, Outlook will still render the

original width and blow out the template.

I know I could hard-code the image width for Outlook clients but I also need to handle
smaller widths as well.

Any help would be appreciated. Thanks.

Mark_Kalamaridi_0-1668446229398.png

 

9 REPLIES 9
SanfordWhiteman
Level 10 - Community Moderator

Re: Prevent oversized images in email templates

Don’t see how such a measure (even if it superficially existed) could be enforced, since you could just swap the image in Design Studio and break it all the same.

Mark_Kalamaridi
Level 2

Re: Prevent oversized images in email templates

Thank you. True about swapping images. I'm actually looking for a code work-around that'll

prevent the email from breaking when the large images sneak in. This problem does come up a lot here.

Setting a max-width works but not on Outlook. I could target Outlook with a fixed width but the images uploaded

aren't always the same width. 

So I'm really looking for a max-width work-around for Outlook.

 

Disha_Goyal6
Level 3

Re: Prevent oversized images in email templates

Hi @Mark_Kalamaridi,

 

Max-width CSS will not work in outlook email clients. For that, you have to give fixed width to the images.

 

Hope this helps!

 

Thanks,

Disha

Mark_Kalamaridi
Level 2

Re: Prevent oversized images in email templates

Thank you. Unfortunately the uploaded images are of varying widths so setting a fixed width for Outlook won't always work.

Disha_Goyal6
Level 3

Re: Prevent oversized images in email templates

Hi @Mark_Kalamaridi, you have to give fixed width in code like width="600". In this case, images will automatically adjust to this width and outlook email client will not create any issue. 

 

Make sure, your width size should be locked at template level. 

 

Thanks,

Disha

Mark_Kalamaridi
Level 2

Re: Prevent oversized images in email templates

Thanks.

 

Unfortunately, I can't use a fixed width in order to handle images with smaller widths being uploaded from the image picker.

 

Disha_Goyal6
Level 3

Re: Prevent oversized images in email templates

Hi @Mark_Kalamaridi, Other than this, there is no other way to fix images in outlook. 

 

Thanks,

Disha

Jasbir_Kaur
Level 4

Re: Prevent oversized images in email templates

Hi @Mark_Kalamaridi,

 

In this case, you can create a variable of the fixed width at the template level and on the emails if the images size is varying then you can simply change the width of image from the variable.

 

Hope this will sort your issue.

 

Thanks!

Jasbir

SanfordWhiteman
Level 10 - Community Moderator

Re: Prevent oversized images in email templates

Except you would not know when you needed to change the variable. The idea is to stop people from breaking the layout on their own.