diff --git a/src/backend/model/mediamessengers/EmailMediaMessenger.ts b/src/backend/model/mediamessengers/EmailMediaMessenger.ts index 1704161f..921af322 100644 --- a/src/backend/model/mediamessengers/EmailMediaMessenger.ts +++ b/src/backend/model/mediamessengers/EmailMediaMessenger.ts @@ -57,6 +57,7 @@ export class EmailMediaMessenger { ' \n' + ''; let htmlMiddle = ''; + const numberOfColumns = media.length >= 6 ? 3 : 2; for (let i = 0; i < media.length; ++i) { const thPath = await this.getThumbnail(media[i]); const linkUrl = Utils.concatUrls(Config.Server.publicUrl, '/gallery/', encodeURIComponent(path.join(media[i].directory.path, media[i].directory.name))) + @@ -71,15 +72,15 @@ export class EmailMediaMessenger { path: thPath, cid: 'img' + i }); - if (i % 2 == 0) { + if (i % numberOfColumns == 0) { htmlMiddle += ''; } htmlMiddle += '\n' + - ' ' + media[i].name + '\n' + + ' ' + media[i].name + '\n' + caption + ' \n'; - if (i % 2 == 1 || i === media.length - 1) { + if (i % numberOfColumns == (numberOfColumns - 1) || i === media.length - 1) { htmlMiddle += ''; } }