Change Image Size on gmail addon.

284 views
Skip to first unread message

Javi Garcia

unread,
Dec 27, 2021, 3:29:16 AM12/27/21
to Google Apps Script Community
I want to insert three images in my gmail addon, one below the other. The problem is that the images are automatically scaled and are too big, so to see the three at the same time I have to scroll when I would like to see them directly. I haven't seen information to resize an image in the documentation, nor a gridItem if I end up inserting them there .I have also tried with icons but I have not achieved the result I expected.

Thanks!

Clark Lind

unread,
Dec 27, 2021, 10:20:05 AM12/27/21
to Google Apps Script Community
I was able to use most of this repo, tailored to save pdf files with inline images to Drive. 
It uses an html template for formatting the images, so it may give you some ideas.
https://github.com/dunronet/GmailMessage-to-DriveFileArray

Clark Lind

unread,
Dec 27, 2021, 10:21:59 AM12/27/21
to Google Apps Script Community
[edit]
I was able to use most of this repo, tailored to save email messages with embedded images as pdf files with inline images to Drive. 

It uses an html template for formatting the images, so it may give you some ideas.
https://github.com/dunronet/GmailMessage-to-DriveFileArray

Clark Lind

unread,
Dec 28, 2021, 9:19:38 AM12/28/21
to Google Apps Script Community
This may help also. This works for me:

// This code fetches the Google and YouTube logos, inlines them in an email
// and sends the email
function inlineImage() {
var youtubeLogoUrl =
var googleLogoBlob = UrlFetchApp
                     .fetch(googleLogoUrl)
                     .getBlob()
                     .setName("googleLogoBlob");
var youtubeLogoBlob = UrlFetchApp
                      .fetch(youtubeLogoUrl)
                      .getBlob()
                      .setName("youtubeLogoBlob");
MailApp.sendEmail({
to: " ", // insert email address
subject: "Logos",
htmlBody: `<table><tr>
    <td><img height="24px" width="74px" src='cid:googleLogo'></td>
    <td><img height="42px" width="98px" src='cid:youtubeLogo'></td>
  </tr>
</table>`,
inlineImages:
  {
    googleLogo: googleLogoBlob,
    youtubeLogo: youtubeLogoBlob
  }
});
}

Result:
inline-images.jpg
Reply all
Reply to author
Forward
0 new messages