mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 21:29:43 +02:00
parent
d420f6cb27
commit
0f50dbde92
4 changed files with 34 additions and 12 deletions
|
@ -26,7 +26,7 @@ module.exports = {
|
||||||
fs.mkdirSync(rootPath);
|
fs.mkdirSync(rootPath);
|
||||||
await moveFile(inputs.file.fd, filePath);
|
await moveFile(inputs.file.fd, filePath);
|
||||||
|
|
||||||
const image = sharp(filePath, {
|
let image = sharp(filePath, {
|
||||||
animated: true,
|
animated: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -46,7 +46,11 @@ module.exports = {
|
||||||
const thumbnailsPath = path.join(rootPath, 'thumbnails');
|
const thumbnailsPath = path.join(rootPath, 'thumbnails');
|
||||||
fs.mkdirSync(thumbnailsPath);
|
fs.mkdirSync(thumbnailsPath);
|
||||||
|
|
||||||
const { width, pageHeight: height = metadata.height } = metadata;
|
let { width, pageHeight: height = metadata.height } = metadata;
|
||||||
|
if (metadata.orientation && metadata.orientation > 4) {
|
||||||
|
[image, width, height] = [image.rotate(), height, width];
|
||||||
|
}
|
||||||
|
|
||||||
const isPortrait = height > width;
|
const isPortrait = height > width;
|
||||||
const thumbnailsExtension = metadata.format === 'jpeg' ? 'jpg' : metadata.format;
|
const thumbnailsExtension = metadata.format === 'jpeg' ? 'jpg' : metadata.format;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const image = sharp(inputs.file.fd, {
|
let image = sharp(inputs.file.fd, {
|
||||||
animated: true,
|
animated: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -37,7 +37,11 @@ module.exports = {
|
||||||
|
|
||||||
fs.mkdirSync(rootPath);
|
fs.mkdirSync(rootPath);
|
||||||
|
|
||||||
const { width, pageHeight: height = metadata.height } = metadata;
|
let { width, pageHeight: height = metadata.height } = metadata;
|
||||||
|
if (metadata.orientation && metadata.orientation > 4) {
|
||||||
|
[image, width, height] = [image.rotate(), height, width];
|
||||||
|
}
|
||||||
|
|
||||||
const extension = metadata.format === 'jpeg' ? 'jpg' : metadata.format;
|
const extension = metadata.format === 'jpeg' ? 'jpg' : metadata.format;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -17,7 +17,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const image = sharp(inputs.file.fd, {
|
let image = sharp(inputs.file.fd, {
|
||||||
animated: true,
|
animated: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -37,7 +37,11 @@ module.exports = {
|
||||||
|
|
||||||
fs.mkdirSync(rootPath);
|
fs.mkdirSync(rootPath);
|
||||||
|
|
||||||
const { width, pageHeight: height = metadata.height } = metadata;
|
let { width, pageHeight: height = metadata.height } = metadata;
|
||||||
|
if (metadata.orientation && metadata.orientation > 4) {
|
||||||
|
[image, width, height] = [image.rotate(), height, width];
|
||||||
|
}
|
||||||
|
|
||||||
const extension = metadata.format === 'jpeg' ? 'jpg' : metadata.format;
|
const extension = metadata.format === 'jpeg' ? 'jpg' : metadata.format;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -6,7 +6,7 @@ const getConfig = require('../../get-config');
|
||||||
const processUserAvatar = async (user, userAvatarsPath) => {
|
const processUserAvatar = async (user, userAvatarsPath) => {
|
||||||
const rootPath = path.join(userAvatarsPath, user.avatar.dirname);
|
const rootPath = path.join(userAvatarsPath, user.avatar.dirname);
|
||||||
|
|
||||||
const image = sharp(path.join(rootPath, `original.${user.avatar.extension}`), {
|
let image = sharp(path.join(rootPath, `original.${user.avatar.extension}`), {
|
||||||
animated: true,
|
animated: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -17,7 +17,10 @@ const processUserAvatar = async (user, userAvatarsPath) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { width, pageHeight: height = metadata.height } = metadata;
|
let { width, pageHeight: height = metadata.height } = metadata;
|
||||||
|
if (metadata.orientation && metadata.orientation > 4) {
|
||||||
|
[image, width, height] = [image.rotate(), height, width];
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await image
|
await image
|
||||||
|
@ -37,7 +40,7 @@ const processUserAvatar = async (user, userAvatarsPath) => {
|
||||||
const processProjectBackgroundImage = async (project, projectBackgroundImagesPath) => {
|
const processProjectBackgroundImage = async (project, projectBackgroundImagesPath) => {
|
||||||
const rootPath = path.join(projectBackgroundImagesPath, project.background_image.dirname);
|
const rootPath = path.join(projectBackgroundImagesPath, project.background_image.dirname);
|
||||||
|
|
||||||
const image = sharp(path.join(rootPath, `original.${project.background_image.extension}`), {
|
let image = sharp(path.join(rootPath, `original.${project.background_image.extension}`), {
|
||||||
animated: true,
|
animated: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -48,7 +51,10 @@ const processProjectBackgroundImage = async (project, projectBackgroundImagesPat
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { width, pageHeight: height = metadata.height } = metadata;
|
let { width, pageHeight: height = metadata.height } = metadata;
|
||||||
|
if (metadata.orientation && metadata.orientation > 4) {
|
||||||
|
[image, width, height] = [image.rotate(), height, width];
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await image
|
await image
|
||||||
|
@ -69,7 +75,7 @@ const processAttachmentImage = async (attachment, attachmentsPath) => {
|
||||||
const rootPath = path.join(attachmentsPath, attachment.dirname);
|
const rootPath = path.join(attachmentsPath, attachment.dirname);
|
||||||
const thumbnailsPath = path.join(rootPath, 'thumbnails');
|
const thumbnailsPath = path.join(rootPath, 'thumbnails');
|
||||||
|
|
||||||
const image = sharp(path.join(rootPath, attachment.filename), {
|
let image = sharp(path.join(rootPath, attachment.filename), {
|
||||||
animated: true,
|
animated: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -80,7 +86,11 @@ const processAttachmentImage = async (attachment, attachmentsPath) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { width, pageHeight: height = metadata.height } = metadata;
|
let { width, pageHeight: height = metadata.height } = metadata;
|
||||||
|
if (metadata.orientation && metadata.orientation > 4) {
|
||||||
|
[image, width, height] = [image.rotate(), height, width];
|
||||||
|
}
|
||||||
|
|
||||||
const isPortrait = height > width;
|
const isPortrait = height > width;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue