用途:通过 Sirv CDN 的 URL 参数对图片进行实时转换,无需预先处理。基础形式为 https://yourcdn.sirv.com/path/image.jpg?{options}。建议使用高质量原图,在交付时再做转换。
主要能力:尺寸(w、h、s、thumbnail、scale.option=fit/fill/ignore/noup);裁剪(cw、ch、cx、cy、crop.type=trim/poi/face);格式与质量(format=jpg/png/webp/avif/optimal/original,q 默认约 80,subsampling);特效(blur、sharpen、brightness、contrast、saturation、grayscale、rotate、colortone);文字叠加(text、text.size、text.color、text.position、text.font.family、text.opacity);水印(watermark、watermark.position、watermark.opacity、watermark.scale.width);画布与边框(canvas.width/height/color、frame.style/color/width)。
处理顺序固定为自动裁剪、缩放、裁剪、画布、旋转、其他特效,URL 参数顺序不影响该顺序;URL 参数先于 profile 设置,profile 先于 Default profile。
用法:可直接在 img 的 src/srcset 中拼接参数,或用 picture 提供 avif/webp 回退;重复配方可保存为 /Profiles/ 下的 JSON profile,用 ?profile=名称 调用。Web 交付优先 format=optimal 或账户默认;强制 WebP/AVIF 时需核对回退行为。修改参数名、默认值或回退前应查阅 Sirv 官方文档。
适用场景:响应式 srcset、现代格式回退、产品缩略图、LCP 主图、带水印下载等。
限制:涉及图库交互、缩放/旋转/视频/模型/PDF 查看、缩略图、全屏、移动断点、Sirv JS 加载或查看器 API 时,应改用 sirv-media-viewer。避免手写大量重复查询串、误删已有查询参数或签名 URL、把缩略图与最终交付 URL 视为同一转换契约;除非明确需要变形,否则不要用 scale.option=ignore。可用 curl -I 检查 content-type、content-length 与缓存头,并核对渲染尺寸与显示尺寸乘 DPR 是否接近。