VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: EIF on March 09, 2022, 21:29:59 PM

Title: Change propduct thumbnail size in mails
Post by: EIF on March 09, 2022, 21:29:59 PM
In the order confirmation mails the customer gets, I display the thumbnail of the product he/she has ordered.

I am using this code:
<?php if (!empty($item->images[0])) { echo $item->images[0]->displayMediaThumb ('',FALSE,""truefalsetrue);} ?>

The thumbnail size I use in the shop is 400px x 400px. For the mail is that way to big.

How can change the thumnail size in the mails, for example 150 x 150? I was trying to set a td with or a fixed div with, but without success.
Anyone has the right code to do this?
Title: Re: Change propduct thumbnail size in mails
Post by: Jumbo! on March 10, 2022, 08:54:20 AM
You can try by using the following codes -

<?php if (!empty($item->images[0])) echo $item->images[0]->displayMediaThumb ('style="width: 150px; height: auto; max-height: 150px;"'false''truefalsetrue); ?>
Title: Re: Change propduct thumbnail size in mails
Post by: EIF on March 10, 2022, 09:18:02 AM
Thank you for your reply.

I tried your code, but the image size is still the same big size in outlook (office365).

On my phone (Iphone) it does resize to a smaller version.

Any idea why the style does not work in Outlook?


<td align="left">
<?php if (!empty($item->images[0])) echo $item->images[0]->displayMediaThumb ('style="width: 150px; height: auto; max-height: 150px;"'false''truefalsetrue); ?>
</td>
<td align="left">
<?php echo $item->order_item_sku?>
</td>
Title: Re: Change propduct thumbnail size in mails
Post by: diri on March 10, 2022, 09:29:58 AM
Outlook is known to be a beast (not only) in this relation.

A starting point might be https://jasemiller.medium.com/a-fix-for-outlook-image-issues-in-html-email-campaigns-b8dd1c8f7d16, Google or you.com might be your friends as well.

hth, diri
Title: Re: Change propduct thumbnail size in mails
Post by: EIF on March 10, 2022, 12:19:58 PM
Tried the mso in the code, but with no luck.

Any ideas?
Title: Re: Change propduct thumbnail size in mails
Post by: GJC Web Design on March 10, 2022, 14:10:14 PM
try

<?php if (!empty($item->images[0])) { echo $item->images[0]->displayMediaThumb ('',FALSE,"", true, false, true,150,150);} ?>
Title: Re: Change propduct thumbnail size in mails
Post by: pinochico on March 10, 2022, 14:40:36 PM
to GJC:

Thanks, is the better solution :)