mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
feat: better image alignment and loading performance
This commit is contained in:
1 parent
429049761f
commit
4683de90ba
2 files changed
+57
-6
No files matched your search
@@ -1,13 +1,50 @@
|
||||
export enum ImgurSize {
|
||||
/**
|
||||
* The default size
|
||||
*/
|
||||
Default = '',
|
||||
/**
|
||||
* Unknown size but really really small
|
||||
*/
|
||||
UltraSmall = 'ss',
|
||||
/**
|
||||
* 90x90
|
||||
*/
|
||||
SmallSquare = 's',
|
||||
/**
|
||||
* 160x160
|
||||
*/
|
||||
BigSquare = 'b',
|
||||
/**
|
||||
* 160x160
|
||||
*/
|
||||
SmallThumbnail = 't',
|
||||
/**
|
||||
* 320x320
|
||||
*/
|
||||
MediumThumbnail = 'm',
|
||||
/**
|
||||
* 640x640
|
||||
*/
|
||||
LargeThumbnail = 'l',
|
||||
/**
|
||||
* 1024x1024
|
||||
*/
|
||||
HugeThumbnail = 'h',
|
||||
}
|
||||
|
||||
interface ImgurOptions {
|
||||
format: 'jpeg' | 'png';
|
||||
size: ImgurSize;
|
||||
}
|
||||
|
||||
const defaultImgurOptions: ImgurOptions = {
|
||||
format: 'png',
|
||||
size: ImgurSize.Default,
|
||||
};
|
||||
|
||||
export function imgur(id: string, imgurOptions?: Partial<ImgurOptions>) {
|
||||
const options = { ...defaultImgurOptions, ...imgurOptions };
|
||||
|
||||
return `https://i.imgur.com/${id}.${options.format}`;
|
||||
return `https://i.imgur.com/${id}${options.size}.${options.format}`;
|
||||
}
|
||||
Reference in new issue
Block a user