mirror of
https://github.com/chenasraf/dotfiles.git
synced 2026-05-17 17:28:07 +00:00
17 lines
412 B
TypeScript
17 lines
412 B
TypeScript
export function fallbackImageUrl(
|
|
text: string,
|
|
{ width, height }: Record<'width' | 'height', number>,
|
|
): string {
|
|
const qs = new URLSearchParams({
|
|
bg_color: '008000',
|
|
fg_color: 'FFFFFF',
|
|
text,
|
|
})
|
|
|
|
return `https://placeholder.photo/img/${width}x${height}?` + qs.toString()
|
|
}
|
|
|
|
export function apiFallbackImageUrl(url: string): string {
|
|
return `/api/image?url=${decodeURIComponent(url)}`
|
|
}
|