模块概览#
对于随机图像,请使用 {{$image.url}}。这不会直接返回图像,而是返回一个指向来自两个演示图像提供商之一("Picsum" 和 "LoremFlickr")的图像 URL。你可以使用 {{$image.urlLoremFlickr}} 或 {{$image.urlPicsumPhotos}},从两个提供商之一专门请求图像。对于仅包含纯色和文本的随机占位图像,请使用 {{$image.urlPlaceholder}}(使用第三方服务)或 {{$image.dataUri}}(返回 SVG 字符串)。对于随机用户头像图像,请使用 {{$image.avatar}}。此模块以前还包含用于特定主题图像的方法,例如 "fashion" 或 "food",但这些方法现在已弃用。如果你需要对图像类型进行更多控制,可以使用 {{$image.urlLoremFlickr}} 请求分类图像,直接使用图像提供商,或提供你自己的占位图像集。
avatar#
avatarGitHub#
avatarLegacy#
从 https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar 生成随机头像。
dataUri#
生成包含 URL 编码 SVG 图像或 Base64 编码 SVG 图像的随机 data uri。| 名称 | 类型 | 默认值 | 描述 |
|---|
| color | string | {{$color.rgb}} | 图像的颜色。必须是 svg 支持的颜色。 |
| height | number | {{$number.int(min=1,max=3999)}} | 图像的高度。 |
| type | 'svg-uri' | 'svg-base64' | {{$helpers.arrayElements(['svg-uri','svg-base64'])}} | 图像的类型。 |
| width | number | {{$number.int(min=1,max=3999)}} | 图像的宽度。 |
url#
| 名称 | 类型 | 默认值 | 描述 |
|---|
| height | number | {{$number.int(min=1,max=3999)}} | 图像的高度。 |
| width | number | {{$number.int(min=1,max=3999)}} | 图像的宽度。 |
urlLoremFlickr#
| 名称 | 类型 | 默认值 | 描述 |
|---|
| category | string | | 用于图像的类别。 |
| height | number | {{$number.int(min=1,max=3999)}} | 图像的高度。 |
| width | number | {{$number.int(min=1,max=3999)}} | 图像的宽度。 |
urlPicsumPhotos#
| 名称 | 类型 | 默认值 | 描述 |
|---|
| blur | 0 | 10 | 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{$number.int(max=10)}} | 图像是否应模糊。0 禁用模糊。 |
| grayscale | boolean | {{$datatype.boolean}} | 图像是否应为灰度。 |
| height | number | {{$number.int(min=1,max=3999)}} | 图像的高度。 |
| width | number | {{$number.int(min=1,max=3999)}} | 图像的宽度。 |
urlPlaceholder#
| 名称 | 类型 | 默认值 | 描述 |
|---|
| backgroundColor | string | {{$color.rgb(prefix=' ',format='hex')}} | 图像的背景颜色。 |
| format | 'gif' | 'jpeg' | 'jpg' | 'png' | 'webp' | {{$helpers.arrayElement(['gif','jpeg','jpg','png','webp'])}} | 图像的格式。 |
| height | number | {{$number.int(min=1,max=3999)}} | 图像的高度。 |
| text | number | {{$color.rgb(prefix=' ',format='hex')}} | 要显示在图像上的文本。 |
| textColor | string | {{$number.int(min=1,max=3999)}} | 图像的文本颜色。 |
| width | number | {{$number.int(min=1,max=3999)}} | 图像的宽度。 |
Modified at 2026-06-09 08:55:47