More changes for db migration
This commit is contained in:
parent
de0284e48a
commit
889dc02945
33 changed files with 740 additions and 100 deletions
|
@ -55,17 +55,17 @@ function scale(path, type, size) {
|
|||
});
|
||||
}
|
||||
|
||||
export default function resize(path, type, currentSize, dim) {
|
||||
export default function resize(path, type, currentSize, newSize) {
|
||||
debug('Resizing');
|
||||
const ratio = 970 / currentSize.width;
|
||||
debug(dim.width, ratio);
|
||||
if (dim.width <= 150) {
|
||||
debug(newSize.width, ratio);
|
||||
if (newSize.width <= 150) {
|
||||
debug('Cover');
|
||||
return cover(path, type, dim);
|
||||
} else if (dim.width >= 970 && ratio < 1) {
|
||||
return cover(path, type, newSize);
|
||||
} else if (newSize.width >= 970 && ratio < 1) {
|
||||
debug('Scale');
|
||||
dim.height = currentSize.height * ratio; // eslint-disable-line no-param-reassign
|
||||
return scale(path, type, dim);
|
||||
newSize.height = currentSize.height * ratio; // eslint-disable-line no-param-reassign
|
||||
return scale(path, type, newSize);
|
||||
}
|
||||
debug('Copy');
|
||||
return fs.readFile(path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue