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:
Alex
2022-05-28 22:35:45 -05:00
committed by GitHub
parent bdf38e7668
commit d476b15312
17 changed files with 579 additions and 86 deletions

View File

@@ -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)}`);
},
}),
};