Postgres.

This commit is contained in:
Jonathan Cremin 2016-06-19 10:14:47 -07:00
parent 695644c260
commit 806f42e3f8
25 changed files with 501 additions and 294 deletions

View file

@ -55,17 +55,17 @@ function scale(path, type, size) {
});
}
export default function resize(path, type, currentSize, newSize) {
export default function resize(path, type, currentSize, dim) {
debug('Resizing');
const ratio = 970 / currentSize.width;
debug(newSize.width, ratio);
if (newSize.width <= 150) {
debug(dim.width, ratio);
if (dim.width <= 150) {
debug('Cover');
return cover(path, type, newSize);
} else if (newSize.width >= 970 && ratio < 1) {
return cover(path, type, dim);
} else if (dim.width >= 970 && ratio < 1) {
debug('Scale');
newSize.height = currentSize.height * ratio; // eslint-disable-line no-param-reassign
return scale(path, type, newSize);
dim.height = currentSize.height * ratio; // eslint-disable-line no-param-reassign
return scale(path, type, dim);
}
debug('Copy');
return fs.readFile(path);