Skip to content

Commit

Permalink
Merge branch 'canary' into image-component-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
styfle committed Oct 21, 2020
2 parents bc2c1fa + 1a8cb7e commit 06e6884
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/next/client/image.tsx
Expand Up @@ -4,10 +4,11 @@ import Head from '../next-server/lib/head'
const loaders = new Map<LoaderKey, (props: LoaderProps) => string>([
['imgix', imgixLoader],
['cloudinary', cloudinaryLoader],
['akamai', akamaiLoader]
['default', defaultLoader],
])

type LoaderKey = 'default' | 'imgix' | 'cloudinary'
type LoaderKey = 'imgix' | 'cloudinary' | 'akamai' | 'default'

type ImageData = {
sizes: number[]
Expand Down Expand Up @@ -303,6 +304,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 = ['f_auto']
let paramsString = ''
Expand Down

0 comments on commit 06e6884

Please sign in to comment.