generated from taylorbryant/gatsby-starter-tailwind
-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Updated public CDN to new media server [ fixes #1013] * perf: defer loading volunteers avatar images * fix: remove usage of MobileLoader and remove hard webp format
- Loading branch information
Showing
7 changed files
with
19 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const BASE_URL = process.env.NEXT_PUBLIC_CDN_URL | ||
const imageLoader = ({ src, width, quality }) => { | ||
if (src.includes(BASE_URL)) { | ||
return src | ||
} | ||
return `${process.env.NEXT_PUBLIC_CDN_URL}${src}?w=${width}&q=${quality || 75}` | ||
} | ||
|
||
export default imageLoader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
import { ImageLoaderProps } from 'next/image' | ||
import { CLIENT_CONFIG } from '../configs/clientConfig' | ||
|
||
const DEFAULT_IMAGE_QUALITY = 90 | ||
/** | ||
* Custom NextJS image loader | ||
*/ | ||
export const DefaultLoader = ({ src, width, quality }: ImageLoaderProps): string => { | ||
return `${CLIENT_CONFIG.CDN_BASE_URL}${src}?format=webp&w=${width}&q=${quality ?? '90'}` | ||
return `${CLIENT_CONFIG.CDN_BASE_URL}${src}?w=${width}&q=${quality ?? DEFAULT_IMAGE_QUALITY}` | ||
} | ||
|
||
/** | ||
* Desktop preview loader | ||
*/ | ||
export const DesktopPreviewLoader = ({ src, width, quality }: ImageLoaderProps): string => { | ||
return `${CLIENT_CONFIG.CDN_BASE_URL}${src}?format=webp&thumbnail=300&q=${quality ?? '90'}` | ||
return `${CLIENT_CONFIG.CDN_BASE_URL}${src}?thumbnail=300&q=${quality ?? DEFAULT_IMAGE_QUALITY}` | ||
} | ||
|
||
/** | ||
* Custom NextJS image loader for mobile | ||
*/ | ||
export const MobileLoader = ({ src, width = 650, quality }: ImageLoaderProps): string => { | ||
return `${CLIENT_CONFIG.CDN_BASE_URL}${src}?format=webp&w=${width}&q=${quality ?? '90'}` | ||
return `${CLIENT_CONFIG.CDN_BASE_URL}${src}?w=${width}&q=${quality ?? DEFAULT_IMAGE_QUALITY}` | ||
} |
00b42e2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
open-tacos – ./
open-tacos-git-develop-openbeta-dev.vercel.app
open-tacos-openbeta-dev.vercel.app
tacos.openbeta.io
openclimbmap.com
openbeta.io
www.openbeta.io