Skip to content

Commit

Permalink
Image Component: Support for Akamai image CDN (#18100)
Browse files Browse the repository at this point in the history
  • Loading branch information
atcastle committed Oct 21, 2020
1 parent 548d193 commit 1a8cb7e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/next/client/image.tsx
Expand Up @@ -4,6 +4,7 @@ import Head from '../next-server/lib/head'
const loaders: { [key: string]: (props: LoaderProps) => string } = {
imgix: imgixLoader,
cloudinary: cloudinaryLoader,
akamai: akamaiLoader,
default: defaultLoader,
}

Expand Down Expand Up @@ -308,6 +309,10 @@ function imgixLoader({ root, src, width, quality }: LoaderProps): string {
return `${root}${normalizeSrc(src)}${paramsString}`
}

function akamaiLoader({ root, src, width }: LoaderProps): string {
return `${root}${normalizeSrc(src)}${width ? '?imwidth=' + width : ''}`
}

function cloudinaryLoader({ root, src, width, quality }: LoaderProps): string {
const params = []
let paramsString = ''
Expand Down

0 comments on commit 1a8cb7e

Please sign in to comment.