imgproc

imgproc 图片处理短代码可在当前页面资源包 Page Bundle 中查找指定图片,并根据一组处理指令对其进行缩放处理。

效果

效果暂时无法展示,运行会报错

{{% imgproc spruce Fill “400x450” %}} Norway Spruce Picea abies shoot with foliage buds. {{% /imgproc %}}

包含 “spruce” 的名称的图片

语法

{{% imgproc spruce Fill "400x450" %}}
Norway Spruce *Picea abies* shoot with foliage buds.
{{% /imgproc %}}

若短代码的内部内容及 byline 参数均采用 Markdown 格式编写,请使用上方语法。若内容为 HTML 格式,则需使用 <> 作为最内层分隔符:{{< imgproc >}}<b>HTML</b> content{{< /imgproc >}}

上面的示例还通过署名参数添加了图片来源说明。当使用来WikiMedia等平台的免费授权插图时,多数情况下需要注明作者或许可方信息。您可以在页面前置元数据中为页面资源添加元数据。本主题约定使用byline参数来实现此功能:

+++
[[resources]]
src = "**spruce*.jpg"

  [resources.params]
  byline = "*Photo*: Bjørn Erik Pedersen / CC-BY-SA"
+++
---
resources:
- src: "**spruce*.jpg"
  params:
    byline: "*Photo*: Bjørn Erik Pedersen / CC-BY-SA"
---
{
  "resources": [
    {
      "src": "**spruce*.jpg",
      "params": {
        "byline": "*Photo*: Bjørn Erik Pedersen / CC-BY-SA"
      }
    }
  ]
}
Parameter Description
1 The image filename or enough of it to identify it (we do Glob matching)
2 Command. One of Fit, Resize, Fill or Crop. See Image Processing Methods.
3 Processing options, e.g. 400x450 r180. See Image Processing Options.