This commit is contained in:
or-else
2019-01-25 14:24:43 +03:00
parent a0184ac002
commit bd7531e5b7
7 changed files with 35 additions and 29 deletions
+7 -1
View File
@@ -15,7 +15,13 @@ export function makeImageUrl(photo) {
// Returns an object which contains destination sizes, source sizes, and offsets
// into source (when making square images).
export function fitImageSize(width, height, maxWidth, maxHeight, forceSquare) {
if (!width || !height || !maxWidth || !maxHeight) {
// Sanitize input
width = width | 0;
height = height | 0;
maxWidth = maxWidth | 0;
maxHeight = maxHeight | 0;
if (width <= 0 || height <= 0 || maxWidth <= 0 || maxHeight <= 0) {
return null;
}