feat: upload profile picture from google (#964)
* feat: upload profile picture from google * fix: only add profile picture if user don't have any
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import axios from 'axios';
|
||||
|
||||
const cropRegex = /([w|h])([0-9]+)/;
|
||||
|
||||
export type ShortCropSize = `${'w' | 'h'}${number}` | 'original';
|
||||
@ -19,3 +21,11 @@ export const getCropSize = (value: ShortCropSize): CropSize | null => {
|
||||
value: +match[2],
|
||||
};
|
||||
};
|
||||
|
||||
export const getImageBufferFromUrl = async (url: string): Promise<Buffer> => {
|
||||
const response = await axios.get(url, {
|
||||
responseType: 'arraybuffer',
|
||||
});
|
||||
|
||||
return Buffer.from(response.data, 'binary');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user