Round optimized img dimension to next 100px for better caching.
Doing double `Math.ceil()` just to make it easier to disable the 100px thing in the future.
This commit is contained in:
parent
f175a765ae
commit
7ccaf06527
1 changed files with 3 additions and 1 deletions
|
@ -4,7 +4,9 @@ import { getImageProxyUrl, getThumbnailCdnUrl } from 'util/thumbnail';
|
||||||
|
|
||||||
function scaleToDevicePixelRatio(value: number) {
|
function scaleToDevicePixelRatio(value: number) {
|
||||||
const devicePixelRatio = window.devicePixelRatio || 1.0;
|
const devicePixelRatio = window.devicePixelRatio || 1.0;
|
||||||
return Math.ceil(value * devicePixelRatio);
|
const nextInteger = Math.ceil(value * devicePixelRatio);
|
||||||
|
// Round to next 100px for better caching
|
||||||
|
return Math.ceil(nextInteger / 100) * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOptimizedImgUrl(url, width, height, quality) {
|
function getOptimizedImgUrl(url, width, height, quality) {
|
||||||
|
|
Loading…
Reference in a new issue