email-builder-utils 1.1.20 → 1.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/jsonToHTML.js +4 -1
- package/package.json +1 -1
package/dist/utils/jsonToHTML.js
CHANGED
|
@@ -196,6 +196,9 @@ async function convertImageBlock(blockData, cellWidthInPx) {
|
|
|
196
196
|
borderRadius: borderRadius,
|
|
197
197
|
borderColor,
|
|
198
198
|
};
|
|
199
|
+
const image = await jimp_1.Jimp.read(imageUrl);
|
|
200
|
+
const originalWidth = image.bitmap.width;
|
|
201
|
+
const originalHeight = image.bitmap.height;
|
|
199
202
|
// Add border styles to container for fallback clients
|
|
200
203
|
const containerStyles = buildStyles({
|
|
201
204
|
...containerStyle,
|
|
@@ -204,7 +207,7 @@ async function convertImageBlock(blockData, cellWidthInPx) {
|
|
|
204
207
|
perChanges: addPxOrPerToAttributes,
|
|
205
208
|
pxChanges: addPxToAttributes,
|
|
206
209
|
});
|
|
207
|
-
const imageElement = `<img src="${imageUrl}" alt="${altText}" style="${imageTagStyles}" />`;
|
|
210
|
+
const imageElement = `<img src="${imageUrl}" alt="${altText}" style="${imageTagStyles}; max-width: ${originalWidth}px; max-height: ${originalHeight}px;" />`;
|
|
208
211
|
const innerContainerWidth = ((typeof width === "string" ? parseInt(width.replace("%", "")) : width) /
|
|
209
212
|
100) *
|
|
210
213
|
(cellWidthInPx -
|