mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-04-24 03:00:09 -04:00
* support uploading guild logo via web3.storage * Update packages/web/components/Guild/GuildForm.tsx Co-authored-by: δυς <dys@dhappy.org> * Update packages/web/components/Guild/GuildForm.tsx Co-authored-by: δυς <dys@dhappy.org> * storing ipfs://hash in database Co-authored-by: δυς <dys@dhappy.org>
18 lines
495 B
TypeScript
18 lines
495 B
TypeScript
import { imageLink, Maybe } from '@metafam/utils';
|
|
|
|
export const optimizedImage = (key: string, url?: Maybe<string>, opts = {}) => {
|
|
switch (key) {
|
|
case 'logoURL':
|
|
case 'profileImageURL': {
|
|
return imageLink(url, { ar: '1:1', height: 200, ...opts }) ?? undefined;
|
|
}
|
|
case 'backgroundImageURL':
|
|
case 'bannerImageURL': {
|
|
return imageLink(url, { height: 300, ...opts }) ?? undefined;
|
|
}
|
|
default: {
|
|
return imageLink(url, opts) ?? undefined;
|
|
}
|
|
}
|
|
};
|