Skip to content

Commit 043a0f6

Browse files
author
wenyiqing
committed
feat: add edgeonePages image provider
1 parent da8ee76 commit 043a0f6

10 files changed

Lines changed: 124 additions & 311 deletions

File tree

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
---
2-
title: Tencent Cloud
3-
description: Use Tencent Cloud COS imageMogr2 for image processing.
2+
title: EdgeOne Pages
3+
description: Use EdgeOne Pages imageMogr2 for image processing.
44
links:
55
- label: Source
66
icon: i-simple-icons-github
7-
to: https://github.com/nuxt/image/blob/main/src/runtime/providers/tencentCloud.ts
7+
to: https://github.com/nuxt/image/blob/main/src/runtime/providers/edgeonePages.ts
88
size: xs
99
---
1010

11-
Integration with Tencent Cloud COS Cloud Infinite (CI) image processing (`imageMogr2`). Supports resizing, cropping, rotation, format conversion, quality control, Gaussian blur, sharpening, and more.
11+
Integration with EdgeOne Pages image processing (`imageMogr2`). Supports resizing, cropping, rotation, format conversion, quality control, Gaussian blur, sharpening, and more.
1212

1313
## Setup
1414

15-
Set the bucket domain as `baseURL` in `nuxt.config.ts`:
15+
Set the site domain as `baseURL` in `nuxt.config.ts`:
1616

1717
```ts [nuxt.config.ts]
1818
export default defineNuxtConfig({
1919
image: {
20-
tencentCloud: {
21-
baseURL: 'https://<bucket>.cos.<region>.myqcloud.com'
20+
edgeonePages: {
21+
baseURL: 'https://<your-site>.edgeone.app'
2222
}
2323
}
2424
})
2525
```
2626

2727
::note
28-
`baseURL` should point to a publicly accessible COS bucket domain (or a bound CDN domain). No trailing slash is needed.
28+
`baseURL` should point to a publicly accessible EdgeOne Pages domain. No trailing slash is needed.
2929
::
3030

3131
## Basic Usage
3232

3333
```vue
3434
<NuxtImg
35-
provider="tencentCloud"
35+
provider="edgeonePages"
3636
src="/path/to/image.png"
3737
width="600"
3838
height="400"
@@ -43,9 +43,9 @@ export default defineNuxtConfig({
4343

4444
## Standard Modifiers
4545

46-
All 7 standard NuxtImg modifiers are mapped to COS imageMogr2:
46+
All 7 standard NuxtImg modifiers are mapped to imageMogr2:
4747

48-
| Modifier | COS Mapping | Description |
48+
| Modifier | Mapping | Description |
4949
|---|---|---|
5050
| `width` / `height` | `/thumbnail/<W>x<H>` | Proportional scaling, affected by `fit` |
5151
| `fit` | thumbnail suffix | `contain``<W>x<H>`, `cover``!<W>x<H>r`, `fill``<W>x<H>!` |
@@ -54,11 +54,11 @@ All 7 standard NuxtImg modifiers are mapped to COS imageMogr2:
5454
| `background` | `/pad/1/color/<base64>` | Used with scaling, fills background color |
5555
| `blur` | `/blur/<n>x<n>` | Gaussian blur |
5656

57-
## COS Extended Modifiers
57+
## Extended Modifiers
5858

59-
Pass Tencent Cloud-specific image processing parameters via the `:modifiers` prop:
59+
Pass EdgeOne Pages-specific image processing parameters via the `:modifiers` prop:
6060

61-
| Modifier | COS Mapping | Description |
61+
| Modifier | Mapping | Description |
6262
|---|---|---|
6363
| `crop` | `/crop/<W>x<H>` | Regular crop (independent of scaling) |
6464
| `gravity` | `/gravity/<pos>` | Crop anchor: center, north, south, west, east, northwest, etc. |
@@ -78,7 +78,7 @@ Pass Tencent Cloud-specific image processing parameters via the `:modifiers` pro
7878

7979
```vue
8080
<NuxtImg
81-
provider="tencentCloud"
81+
provider="edgeonePages"
8282
src="/photos/banner.png"
8383
width="1200"
8484
height="500"
@@ -93,7 +93,7 @@ Generated URL: `?imageMogr2/thumbnail/!1200x500r/quality/85/format/webp`
9393

9494
```vue
9595
<NuxtImg
96-
provider="tencentCloud"
96+
provider="edgeonePages"
9797
src="/photos/portrait.jpg"
9898
:modifiers="{ crop: '300x300', gravity: 'center' }"
9999
/>
@@ -105,7 +105,7 @@ Generated URL: `?imageMogr2/crop/300x300/gravity/center`
105105

106106
```vue
107107
<NuxtImg
108-
provider="tencentCloud"
108+
provider="edgeonePages"
109109
src="/photos/landscape.jpg"
110110
:modifiers="{ rotate: 90, sharpen: 70, strip: true }"
111111
/>
@@ -117,7 +117,7 @@ Generated URL: `?imageMogr2/rotate/90/sharpen/70/strip`
117117

118118
```vue
119119
<NuxtImg
120-
provider="tencentCloud"
120+
provider="edgeonePages"
121121
src="/photos/hero.jpg"
122122
width="100"
123123
:modifiers="{ blur: 20, quality: 10 }"
@@ -130,7 +130,7 @@ Generated URL: `?imageMogr2/thumbnail/100x/quality/10/blur/20x20`
130130

131131
```vue
132132
<NuxtImg
133-
provider="tencentCloud"
133+
provider="edgeonePages"
134134
src="/photos/group.jpg"
135135
:modifiers="{ scrop: '200x200' }"
136136
/>
@@ -140,10 +140,4 @@ Generated URL: `?imageMogr2/scrop/200x200`
140140

141141
## References
142142

143-
- [COS imageMogr2 Scaling](https://cloud.tencent.com/document/product/436/44880)
144-
- [COS imageMogr2 Cropping](https://cloud.tencent.com/document/product/436/44881)
145-
- [COS imageMogr2 Rotation](https://cloud.tencent.com/document/product/436/44882)
146-
- [COS imageMogr2 Format Conversion](https://cloud.tencent.com/document/product/436/44883)
147-
- [COS imageMogr2 Quality](https://cloud.tencent.com/document/product/436/44884)
148-
- [COS imageMogr2 Gaussian Blur](https://cloud.tencent.com/document/product/436/44885)
149-
- [COS imageMogr2 Sharpen](https://cloud.tencent.com/document/product/436/44886)
143+
- [EdgeOne Pages Image Processing](https://edgeone.ai/document/162498)
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<header class="hero">
44
<div>
55
<p class="eyebrow">
6-
Tencent Cloud · COS
6+
EdgeOne Pages
77
</p>
88
<h1>Image Processing Playground</h1>
99
<p class="lead">
10-
Enter your COS bucket domain and object path to compare the original image with the optimized result from the Nuxt Image tencentCloud provider.
10+
Enter your EdgeOne Pages domain and image path to compare the original image with the optimized result from the Nuxt Image edgeonePages provider.
1111
</p>
1212
</div>
1313
</header>
@@ -16,10 +16,10 @@
1616
<div class="card">
1717
<h2>Parameters</h2>
1818
<div class="field">
19-
<label>Bucket Domain (baseURL)</label>
19+
<label>Site Domain (baseURL)</label>
2020
<input
2121
v-model="baseURL"
22-
placeholder="https://<bucket>.cos.<region>.myqcloud.com"
22+
placeholder="https://<your-site>.edgeone.app"
2323
>
2424
</div>
2525
<div class="field">
@@ -167,7 +167,7 @@
167167
<NuxtImg
168168
v-if="baseURL && src"
169169
:key="refreshKey + '-optimized'"
170-
provider="tencentCloud"
170+
provider="edgeonePages"
171171
:src="src"
172172
:width="width || undefined"
173173
:height="height || undefined"
@@ -213,8 +213,8 @@ import { useRuntimeConfig } from '#imports'
213213
214214
const runtimeConfig = useRuntimeConfig()
215215
216-
const baseURL = ref('https://saas-starter.edgeone.app')
217-
const src = ref('/images/cases/case3.png')
216+
const baseURL = ref('https://nuxt-mix-template.edgeone.site')
217+
const src = ref('/ssg-img.png')
218218
const width = ref<number | null>(800)
219219
const height = ref<number | null>(500)
220220
const fit = ref<'cover' | 'contain' | 'fill' | ''>('contain')
@@ -233,7 +233,7 @@ watchEffect(() => {
233233
cfg.public = cfg.public || {}
234234
cfg.public.image = cfg.public.image || {}
235235
cfg.public.image.providers = cfg.public.image.providers || {}
236-
cfg.public.image.providers.tencentCloud = {
236+
cfg.public.image.providers.edgeonePages = {
237237
baseURL: baseURL.value,
238238
}
239239
})

playground/app/providers.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,42 +1116,42 @@ export const providers: Provider[] = [
11161116
},
11171117
],
11181118
},
1119-
// Tencent Cloud
1119+
// EdgeOne Pages
11201120
{
1121-
name: 'tencentCloud',
1121+
name: 'edgeonePages',
11221122
samples: [
11231123
{
1124-
src: '/images/cases/case3.png',
1124+
src: '/ssg-img.png',
11251125
width: 400,
11261126
height: 300,
11271127
fit: 'contain',
11281128
},
11291129
{
1130-
src: '/images/cases/case2.png',
1130+
src: '/ssg-img.png',
11311131
width: 400,
11321132
height: 300,
11331133
fit: 'cover',
11341134
},
11351135
{
1136-
src: '/images/cases/case4.png',
1136+
src: '/ssg-img.png',
11371137
width: 400,
11381138
height: 300,
11391139
fit: 'fill',
11401140
},
11411141
{
1142-
src: '/images/cases/case3.png',
1142+
src: '/ssg-img.png',
11431143
width: 300,
11441144
quality: 80,
11451145
format: 'webp',
11461146
},
11471147
{
1148-
src: '/images/cases/case2.png',
1148+
src: '/ssg-img.png',
11491149
modifiers: {
11501150
rotate: 90,
11511151
},
11521152
},
11531153
{
1154-
src: '/images/cases/case4.png',
1154+
src: '/ssg-img.png',
11551155
modifiers: {
11561156
blur: 15,
11571157
quality: 50,

playground/nuxt.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ export default defineNuxtConfig({
111111
supabase: {
112112
baseURL: 'https://ovzjdhllnxrizgszqlsi.supabase.co/storage/v1/render/image/public/nuxt',
113113
},
114-
tencentCloud: {
115-
baseURL: 'https://saas-starter.edgeone.app',
114+
edgeonePages: {
115+
baseURL: 'https://nuxt-mix-template.edgeone.site',
116116
},
117117
unsplash: {},
118118
vercel: {

src/provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const BuiltInProviders = [
4747
'strapi',
4848
'strapi5',
4949
'supabase',
50-
'tencentCloud',
50+
'edgeonePages',
5151
'twicpics',
5252
'unsplash',
5353
'uploadcare',

0 commit comments

Comments
 (0)