S3 for other controolers
This commit is contained in:
@@ -2,8 +2,7 @@ const YearBanner = require('../models/YearBanner');
|
||||
const {body, validationResult, checkSchema} = require('express-validator');
|
||||
const {_sr} = require('../plugins/serverResponses');
|
||||
const {res404, res500} = require('../plugins/controllersHelperFunctions');
|
||||
const fs = require('fs');
|
||||
const sharp = require('sharp');
|
||||
const {uploadProcessedImage} = require('../plugins/yearBannerImageStorage');
|
||||
|
||||
////// variables
|
||||
const yearBannerWidth = 1920
|
||||
@@ -51,12 +50,13 @@ module.exports.updateYearBanner = [
|
||||
|
||||
imageName = `mainPage_cover.jpg`;
|
||||
|
||||
const target = sharp(image.data)
|
||||
await target
|
||||
.resize(yearBannerWidth, yearBannerHeight, {fit: 'cover'})
|
||||
.toFormat('jpg')
|
||||
.jpeg({quality: yearBannerQuality})
|
||||
.toFile(`./static/uploads/images/mainCover/${imageName}`);
|
||||
await uploadProcessedImage(
|
||||
image.data,
|
||||
imageName,
|
||||
yearBannerWidth,
|
||||
yearBannerHeight,
|
||||
yearBannerQuality
|
||||
);
|
||||
}
|
||||
|
||||
if (yearBanner) {
|
||||
|
||||
Reference in New Issue
Block a user