Skip to content

Commit 246c1ad

Browse files
committed
Update code example
1 parent 44b41d0 commit 246c1ad

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/content/docs/images/transform-images/draw-overlays.mdx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,12 @@ In the example below, the watermark is manipulated with `rotate` and `width` bef
9494

9595
```js
9696
// Fetch image and watermark
97-
const img = await fetch('https://example.com/image.png');
98-
const watermark = await fetch('https://example.com/watermark.png');
99-
100-
const response = await env.IMAGES.input(img.body)
101-
.transform({ width: 1024 })
102-
.draw(env.IMAGES.input(watermark.body).transform({ rotate: 90, width: 128 }), {
103-
opacity: 0.25,
104-
repeat: true,
105-
})
106-
.output({ format: "image/avif" })
107-
.response();
108-
109-
return response;
97+
const response = (
98+
await env.IMAGES.input(img.body)
99+
.transform({ width: 1024 })
100+
.draw(watermark.body, { "opacity": 0.25, "repeat": true })
101+
.output({ format: "image/avif" })
102+
).response();
110103
```
111104

112105
## Examples

0 commit comments

Comments
 (0)