I've built an add-on for Google Workspace using the CardService functions. The add-on runs in Gmail and posts a logo at the top. Aesthetically, the logo looks great on desktop. However, on mobile the logo takes up too much room.
Current code is as follows (snippet and with other data removed):
var imageBytes = DriveApp.getFileById(LogoID).getBlob().getBytes();
var encodedImageURL = "data:image/jpeg;base64," + Utilities.base64Encode(imageBytes);
function cardbuild(isHomepage, section) {
// Explicitly set the value of isHomepage as false if null or undefined.
if (!isHomepage) {
isHomepage = false;
}
// Create common elements (Image, Footer)
var image = CardService.newImage()
//.setImageUrl(logourl)
.setImageUrl(encodedImageURL)
.setAltText('Logo');
var footer = CardService.newFixedFooter()
.setPrimaryButton(CardService.newTextButton()
.setText('v. 2.5:2021-05-12')
.setOpenLink(CardService.newOpenLink()
.setUrl(editurl)));
var header = CardService.newCardSection()
.addWidget(image);
var card = CardService.newCardBuilder()
.addSection(header)
.setFixedFooter(footer);
return card.build();
}
Is there a way for me to use the encodedImageURL to set a smaller size of the image? Alternatively, does anyone know of a way to improve resizing when the add-on runs on Gmail for Android?