跳转到内容
搜索文档

启用灵活变体

最后更新 查看 MarkdownAgent 设置

灵活变体允许您创建具有动态调整大小的变体,可提供比常规变体更多的选项。默认情况下未启用此选项。

通过 Cloudflare 仪表板启用灵活变体

  1. 在 Cloudflare 仪表板中,转到 Hosted Images(托管图像) 页面。

    Go to Hosted images ↗
  2. 选择 Delivery(交付) 标签。

  3. 启用 Flexible variants(灵活变体)

通过 API 启用灵活变体

Update a variant endpoint 发出 PATCH 请求。

curl --request PATCH https://api.cloudflare.com/client/v4/accounts/{account_id}/images/v1/config \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{"flexible_variants": true}'

激活后,您可以在任何 Cloudflare 图像上使用优化参数。例如,

https://imagedelivery.net/{account_hash}/{image_id}/w=400,sharpen=3

这篇文档对您有帮助吗?