mirror of
https://github.com/Art051/immich.git
synced 2025-08-11 19:29:00 +00:00
Implemented user profile upload and show on web/mobile (#191)
* Update mobile dependencies * Added image picker * Added mechanism to upload profile image * Added image type to send to web * Added styling for circle avatar * Fixxed issue with sharp cannot resize image properly * Finished displaying and uploading user profile * Added user profile to web
This commit is contained in:
@@ -19,6 +19,7 @@ export const profileImageUploadOption: MulterOptions = {
|
||||
destination: (req: Request, file: Express.Multer.File, cb: any) => {
|
||||
const basePath = APP_UPLOAD_LOCATION;
|
||||
const profileImageLocation = `${basePath}/${req.user['id']}/profile`;
|
||||
|
||||
if (!existsSync(profileImageLocation)) {
|
||||
mkdirSync(profileImageLocation, { recursive: true });
|
||||
}
|
||||
@@ -28,9 +29,10 @@ export const profileImageUploadOption: MulterOptions = {
|
||||
},
|
||||
|
||||
filename: (req: Request, file: Express.Multer.File, cb: any) => {
|
||||
|
||||
const userId = req.user['id'];
|
||||
|
||||
cb(null, `${userId}`);
|
||||
cb(null, `${userId}${extname(file.originalname)}`);
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user