resize image sizes; add check for images that are too small

This commit is contained in:
Pieter Vander Vennet 2022-05-14 20:11:59 +02:00
parent afbb572340
commit 6e7de538a7
7 changed files with 102 additions and 119 deletions

View file

@ -121,6 +121,18 @@ class ValidateTheme extends DesugaringStep<LayoutConfigJson> {
` Width = ${width} height = ${height}`;
(json.hideFromOverview ? warnings : errors).push(e)
}
const w = parseInt(width);
const h = parseInt(height)
if(w < 370 || h < 370){
const e : string = [
`the icon for theme ${json.id} is too small. Please rescale the icon at ${json.icon}`,
`Even though an SVG is 'infinitely scaleable', the icon should be dimensioned bigger. One of the build steps of the theme does convert the image to a PNG (to serve as PWA-icon) and having a small dimension will cause blurry images.`,
` Width = ${width} height = ${height}; we recommend a size of at least 500px * 500px and to use a square aspect ratio.`,
].join("\n");
(json.hideFromOverview ? warnings : errors).push(e)
}
})
} catch (e) {
console.error("Could not read " + json.icon + " due to " + e)