mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Updated image middleware to use new shared function
- we have a function for generating _o filenames in @tryghost/image-transform as of v0.2.0 - this updates our Ghost code to use it
This commit is contained in:
parent
7f1d3ebc07
commit
7964c1de79
1 changed files with 1 additions and 3 deletions
|
@ -1,5 +1,4 @@
|
||||||
const cloneDeep = require('lodash/cloneDeep');
|
const cloneDeep = require('lodash/cloneDeep');
|
||||||
const path = require('path');
|
|
||||||
const config = require('../../../../config');
|
const config = require('../../../../config');
|
||||||
const {logging} = require('../../../../lib/common');
|
const {logging} = require('../../../../lib/common');
|
||||||
const imageTransform = require('@tryghost/image-transform');
|
const imageTransform = require('@tryghost/image-transform');
|
||||||
|
@ -30,8 +29,7 @@ module.exports = function normalize(req, res, next) {
|
||||||
req.files.push(Object.assign(req.file, {path: out}));
|
req.files.push(Object.assign(req.file, {path: out}));
|
||||||
|
|
||||||
// CASE: push original image, we keep a copy of it
|
// CASE: push original image, we keep a copy of it
|
||||||
const parsedFileName = path.parse(req.file.name);
|
const newName = imageTransform.generateOriginalImageName(req.file.name);
|
||||||
const newName = `${parsedFileName.name}_o${parsedFileName.ext}`;
|
|
||||||
req.files.push(Object.assign(cloneDeep(req.file), {path: originalPath, name: newName}));
|
req.files.push(Object.assign(cloneDeep(req.file), {path: originalPath, name: newName}));
|
||||||
|
|
||||||
next();
|
next();
|
||||||
|
|
Loading…
Reference in a new issue