ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# thumb 生成缩略图 ## thumb 生成缩略图 用于生成缩略图,返回生成缩略图的地址。该标签不受后台缩略图**开启/关闭**配置影响 ## 格式 ``` <pre class="calibre16">``` <span class="token"><</span>img src<span class="token">=</span><span class="token4">"{hkcms:thumb name='$Info.thumb' /}"</span><span class="token">></span> ``` ``` ## 参数 参数名称可选值默认值是否必填支持版本说明name图集变量-必填v2.2.2.20220725width---v2.2.2.20220725缩略图宽度,不填则使用附件里面的缩略图配置height---v2.2.2.20220725缩略图高度,不填则使用附件里面的缩略图配置type参考下面--v2.2.2.20220725缩略图生成方式,默认使用附件里面的缩略图配置auto1/01-v2.2.2.202207251=表示缩略图不存在时自动生成缩略图ishtml1/00-v2.2.2.202207251=表示生成图片标签,0=仅返回缩略图图片地址## 参数说明 - `name` 传入变量,例如在content标签列表用 ``` <pre class="calibre16">``` <span class="token1">{</span>hkcms<span class="token1">:</span>content catid<span class="token">=</span><span class="token4">"10"</span><span class="token1">}</span> <span class="token"><</span>img src<span class="token">=</span><span class="token4">"{hkcms:thumb name='$item.thumb' /}"</span><span class="token">></span> <span class="token1">{</span><span class="token">/</span>hkcms<span class="token1">:</span>content<span class="token1">}</span> ``` ``` - `width`与 `height`分别是缩略图宽度与缩略图高度,这里不填写则使用的是后台缩略图配置 ![](https://img.kancloud.cn/6e/f1/6ef189d78f3d1e5d9d37d9cdc952978f_801x432.png) 指定宽高,如果是按比例缩放宽为250像素时停止缩放 ``` <pre class="calibre16">``` <span class="token1">{</span>hkcms<span class="token1">:</span>content catid<span class="token">=</span><span class="token4">"10"</span><span class="token1">}</span> <span class="token"><</span>img src<span class="token">=</span><span class="token4">"{hkcms:thumb name='$item.thumb' width='250' height='250' /}"</span> <span class="token">></span> <span class="token1">{</span><span class="token">/</span>hkcms<span class="token1">:</span>content<span class="token1">}</span> ``` ``` - `type`缩略图生成方式。 type可选值如下: 1:等比例缩放 2:缩放填充 3:居中裁剪 4:左上角裁剪 5:右下角裁剪 6:固定尺寸缩放 居中裁剪示例,type等于3 ``` <pre class="calibre16">``` <span class="token1">{</span>hkcms<span class="token1">:</span>content catid<span class="token">=</span><span class="token4">"10"</span><span class="token1">}</span> <span class="token"><</span>img src<span class="token">=</span><span class="token4">"{hkcms:thumb name='$item.thumb' type='3' /}"</span><span class="token">></span> <span class="token1">{</span><span class="token">/</span>hkcms<span class="token1">:</span>content<span class="token1">}</span> ``` ``` - `auto` 自动生成缩略图,当传入的图片没有缩略图系统将自动帮该图生成缩略图,默认是自动生成 - `ishtml` 返回带有图片标签的缩略图 ``` <pre class="calibre16">``` <span class="token1">{</span>hkcms<span class="token1">:</span>content catid<span class="token">=</span><span class="token4">"10"</span><span class="token1">}</span> <span class="token1">{</span>hkcms<span class="token1">:</span>thumb name<span class="token">=</span><span class="token4">"$item.thumb"</span> ishtml<span class="token">=</span><span class="token4">"1"</span> <span class="token">/</span><span class="token1">}</span> <span class="token1">{</span><span class="token">/</span>hkcms<span class="token1">:</span>content<span class="token1">}</span> ``` ``` 效果: `<img src="/uploads/20220724/36a864c7eb3d4afbcd54bc1ca1c0da38_thumb.jpg">`