Skip to content

Commit

Permalink
chore(playground): add custom provider (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
reslear committed Jan 28, 2021
1 parent 40ab562 commit a8f4c78
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ export default <NuxtConfig> {
imagekit: {
baseURL: 'https://ik.imagekit.io/demo'
},

providers: {
custom: {
provider: "~/providers/custom",
options: {
baseURL: "https://site.my"
}
}
},
presets: [
{
name: 's50',
Expand Down
9 changes: 9 additions & 0 deletions playground/providers/custom/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { joinURL } from 'ufo'
import type { ProviderGetImage } from '../../../src/types' // '@nuxt/image'

export const getImage: ProviderGetImage = (src, { modifiers = {}, baseURL = '/' } = {}) => {
const operationsString = `w_${modifiers.width}&h_${modifiers.height}`
return {
url: joinURL(baseURL, operationsString, src)
}
}

0 comments on commit a8f4c78

Please sign in to comment.