in public/src/js/utils/validate-image-src.js [121:139]
function validateActualImage (image) {
return new Promise((resolve, reject) => {
let {width, height, ratio, criteria, path, origin, thumb} = image;
let {maxWidth, minWidth, widthAspectRatio, heightAspectRatio} = criteria;
let criteriaRatio = widthAspectRatio && heightAspectRatio ? widthAspectRatio / heightAspectRatio : NaN;
if (maxWidth && maxWidth < width) {
reject(new Error('Images cannot be more than ' + maxWidth + ' pixels wide'));
} else if (minWidth && minWidth > width) {
reject(new Error('Images cannot be less than ' + minWidth + ' pixels wide'));
} else if (criteriaRatio && criteriaRatio - ratio > 0.01) {
reject(new Error('Images must have a ' + widthAspectRatio + ':' + heightAspectRatio + ' aspect ratio'));
} else {
resolve({
path, origin, thumb, width, height
});
}
});
}