// /providers/my-provider
import { joinURL } from 'ufo'
import { createOperationsGenerator } from '#image'
import type { ProviderGetImage } from '@nuxt/image'
const operationsGenerator = createOperationsGenerator()
export const getImage: ProviderGetImage = (src, { modifiers = {}, baseURL } = {}, ctx) => {
if (!baseURL) {
// also support runtime config
baseURL = ctx.options.nuxt.baseURL
}
const operations = operationsGenerator(modifiers)
return {
url: joinURL(baseURL, src + (operations ? '?' + operations : ''))
}
}
// /providers/my-provider
import { joinURL } from 'ufo'
import { createOperationsGenerator } from '#image'
import type { ProviderGetImage } from '@nuxt/image'
const operationsGenerator = createOperationsGenerator()
export const getImage: ProviderGetImage = (src, { modifiers = {}, baseURL } = {}, ctx) => {
if (!baseURL) {
// also support runtime config
baseURL = ctx.options.nuxt.baseURL
}
const operations = operationsGenerator(modifiers)
return {
url: joinURL(baseURL, src + (operations ? '?' + operations : ''))
}
}