first-commit
ci / Validate workspace (push) Has been cancelled
landing-page-ci / Validate landing page (push) Has been cancelled
landing-page-deploy / Deploy landing page (push) Has been cancelled
github-metrics / Generate repository metrics SVG (push) Has been cancelled
refresh-contributors-wall / Refresh contributors wall cache bust (push) Waiting to run
ci / Validate workspace (push) Has been cancelled
landing-page-ci / Validate landing page (push) Has been cancelled
landing-page-deploy / Deploy landing page (push) Has been cancelled
github-metrics / Generate repository metrics SVG (push) Has been cancelled
refresh-contributors-wall / Refresh contributors wall cache bust (push) Waiting to run
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
const R2_PUBLIC_ORIGIN = 'https://static.open-design.ai';
|
||||
const IMAGE_RESIZING_ORIGIN = R2_PUBLIC_ORIGIN;
|
||||
const ASSET_PREFIX = 'landing/assets';
|
||||
|
||||
type ImageOptions = {
|
||||
width: number;
|
||||
quality?: number;
|
||||
};
|
||||
|
||||
export function r2Asset(name: string): string {
|
||||
return `${R2_PUBLIC_ORIGIN}/${ASSET_PREFIX}/${name}`;
|
||||
}
|
||||
|
||||
export function imageAsset(name: string, { width, quality = 85 }: ImageOptions): string {
|
||||
const options = `width=${width},quality=${quality},format=auto`;
|
||||
return `${IMAGE_RESIZING_ORIGIN}/cdn-cgi/image/${options}/${r2Asset(name)}`;
|
||||
}
|
||||
|
||||
export const heroImage = imageAsset('hero.png', { width: 1024, quality: 82 });
|
||||
Reference in New Issue
Block a user