mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
Fixed EACCES permission when mounting bind volume, add dynamic location for backup directory
This commit is contained in:
@@ -4,9 +4,10 @@ import { existsSync, mkdirSync } from 'fs';
|
||||
import { diskStorage } from 'multer';
|
||||
import { extname } from 'path';
|
||||
import { Request } from 'express';
|
||||
import { APP_UPLOAD_LOCATION } from '../constants/upload_location.constant';
|
||||
|
||||
export const multerConfig = {
|
||||
dest: process.env.UPLOAD_LOCATION,
|
||||
dest: APP_UPLOAD_LOCATION,
|
||||
};
|
||||
|
||||
export const multerOption: MulterOptions = {
|
||||
|
||||
1
server/src/constants/upload_location.constant.ts
Normal file
1
server/src/constants/upload_location.constant.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const APP_UPLOAD_LOCATION = './upload';
|
||||
@@ -7,6 +7,7 @@ import sharp from 'sharp';
|
||||
import { existsSync, mkdirSync, readFile } from 'fs';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import ffmpeg from 'fluent-ffmpeg';
|
||||
import { APP_UPLOAD_LOCATION } from '../../constants/upload_location.constant';
|
||||
|
||||
@Processor('optimize')
|
||||
export class ImageOptimizeProcessor {
|
||||
@@ -21,7 +22,7 @@ export class ImageOptimizeProcessor {
|
||||
async resizeUploadedImage(job: Job) {
|
||||
const { savedAsset }: { savedAsset: AssetEntity } = job.data;
|
||||
|
||||
const basePath = this.configService.get('UPLOAD_LOCATION');
|
||||
const basePath = APP_UPLOAD_LOCATION;
|
||||
const resizePath = savedAsset.originalPath.replace('/original/', '/thumb/');
|
||||
|
||||
// Create folder for thumb image if not exist
|
||||
@@ -77,7 +78,7 @@ export class ImageOptimizeProcessor {
|
||||
async resizeUploadedVideo(job: Job) {
|
||||
const { savedAsset, filename }: { savedAsset: AssetEntity; filename: String } = job.data;
|
||||
|
||||
const basePath = this.configService.get('UPLOAD_LOCATION');
|
||||
const basePath = APP_UPLOAD_LOCATION;
|
||||
// const resizePath = savedAsset.originalPath.replace('/original/', '/thumb/');
|
||||
// Create folder for thumb image if not exist
|
||||
const resizeDir = `${basePath}/${savedAsset.userId}/thumb/${savedAsset.deviceId}`;
|
||||
|
||||
Reference in New Issue
Block a user