image-handler.js
334 Bytes
const MAX_WIDTH = 750;
export function getArticleImageSize({width, height, MIN_SCALE}) {
if (width > MAX_WIDTH) {
height = height / (width / MAX_WIDTH);
width = MAX_WIDTH;
}
if (MIN_SCALE && width / height < MIN_SCALE) {
return {
width,
height: width / MIN_SCALE
};
}
return {width, height};
}