Providers
Sanity
Nuxt Image has first class integration with Sanity.
Integration between Sanity and Nuxt Image.
To use this provider you just need to specify the projectId
of your project in Sanity.
export default defineNuxtConfig({
image: {
sanity: {
projectId: 'yourprojectid',
// Defaults to 'production'
// dataset: 'development'
}
}
})
Modifiers
The Sanity provider supports a number of additional modifiers. For a full list, check out the Sanity documentation. All of the modifiers mentioned in the Sanity docs are supported, with the following notes.
Extra convenience modifiers
The following more readable modifiers are also supported:
background
- equivalent tobg
download
- equivalent todl
sharpen
- equivalent tosharp
orientation
- equivalent toor
minHeight
ormin-height
- equivalent tomin-h
maxHeight
ormax-height
- equivalent tomax-h
minWidth
ormin-width
- equivalent tomin-w
maxWidth
ormax-width
- equivalent tomax-w
saturation
- equivalent tosat
fit
In addition to the values specified in the Sanity docs, which are respected, the following options from the default fit behavior are supported:
cover
- this will behave like the Sanity modifiercrop
contain
- this will behave like the Sanity modifierfill
, and defaults to filling with a white background. (You can specify your own background color with thebackground
modifier.)inside
- this will behave like the Sanity modifiermin
outside
- this will behave like the Sanity modifiermax
fill
- this will behave like the Sanity modifierscale
fit: fill
is equivalent to the Sanity parameter ?fit=scale
. If you need the Sanity ?fit=fill
behavior, use fit: contain
instead.format
You can specify any of the formats suppored by Sanity. If this is omitted, the Sanity provider will default to auto=format
.
crop
and hotspot
You can pass your Sanity crop and hotspot image data as modifiers and Nuxt Image will correctly generate the rect
, fp-x
and fp-y
parameters for you.