mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03: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,5 +1,4 @@
|
||||
const cloneDeep = require('lodash/cloneDeep');
|
||||
const path = require('path');
|
||||
const config = require('../../../../config');
|
||||
const {logging} = require('../../../../lib/common');
|
||||
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}));
|
||||
|
||||
// CASE: push original image, we keep a copy of it
|
||||
const parsedFileName = path.parse(req.file.name);
|
||||
const newName = `${parsedFileName.name}_o${parsedFileName.ext}`;
|
||||
const newName = imageTransform.generateOriginalImageName(req.file.name);
|
||||
req.files.push(Object.assign(cloneDeep(req.file), {path: originalPath, name: newName}));
|
||||
|
||||
next();
|
||||
|
Loading…
Reference in New Issue
Block a user