-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ASSETS-36125] Update SVG creation logic #216
Changes from all commits
507088f
8c8f263
ab04f5f
9d5e711
435d5d0
8ed9fec
ffcc41d
213b3aa
1343dfe
0c2a53a
e23f238
4a1e17b
3361e8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -634,13 +634,21 @@ async function imagePostProcess(intermediateRendition, rendition, directories) { | |
|
||
function convertSvg(img, instructions) { | ||
// ImageMagick automatically keeps aspect ratio | ||
// Only using width because ImageMagick will use the smallest value whether it be width or height | ||
const width = instructions.width || SVG_DEFAULT_WIDTH; | ||
let imageSize = SVG_DEFAULT_WIDTH; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be used only if nothing is set in instructions at all. |
||
|
||
if(instructions.width && instructions.height) { | ||
// image magick will keep aspect ratio | ||
imageSize = `${instructions.width}x${instructions.height}`; | ||
} else if(instructions.width) { | ||
imageSize = `${instructions.width}x`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we want to log wether we only got with or height or got both instead of having to examine the cmd? |
||
} else if(instructions.height) { | ||
imageSize = `x${instructions.height}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The x is left for clarity in the command param to know we got height only, and to make sure aspect ratio is kept, since height is the second param (and the first param, width, is "empty"). |
||
} | ||
|
||
img = handleTransparency(img, instructions); | ||
|
||
// some svgs have no size (only percentage width/height), so we scale them to our target size | ||
img.in("-size", `${width}`); // 2020-11-10 img.rawSize() will not be applied at the correct time and the SVG will be upscaled resulting in a fuzzy final rendition | ||
img.in("-size", `${imageSize}`); // 2020-11-10 img.rawSize() will not be applied at the correct time and the SVG will be upscaled resulting in a fuzzy final rendition | ||
return img; | ||
} | ||
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems there was no (visible) change in this rendition |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Off-by-one change - logic change leads to width being 1 px smaller. |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Off-by-one change - logic change leads to width being 1 px smaller. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1091,7 +1091,8 @@ describe("api.js", () => { | |
assert.ok(!fs.existsSync(renditionDir)); | ||
}); | ||
|
||
it('should send metrics - rendition and activation with cgroup metrics', async () => { | ||
it.skip('should send metrics - rendition and activation with cgroup metrics', async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flaky: sometimes (most often) hangs, sometimes runs. Keeping for local testing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this hanging happening in prod too? |
||
// can hang in CI/CD | ||
const receivedMetrics = MetricsTestHelper.mockNewRelic(); | ||
mockFs({ | ||
'/sys/fs/cgroup': { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even more tests hang/fail without this update, because when installing some libs warn of a bad (outdated) node engine.