MODx phpthumbof 在模板中不起作用
MODx phpthumbof doesn't work in template
我在网站的不同部分使用 phpthumbof 来调整图像大小
它使用模板中的 pdoresources 在块中完美运行
[[pdoResources?
&parents=`2`
&limit=`1`
&depth=`2`
&hideContainers=`1`
&includeTVs=`post-main-image`
&tpl=`main-post`
]]
这里是块的代码:
<img src="[[+tv.post-main-image:phpthumbof=`w=360&h=223&zc=1`]]">
但是当我直接从模板调用它时它不起作用
[[*post-main-image:phpthumbof=`w=360&h=223&zc=1`]]
它显示图像但不影响它的大小或裁剪。我该如何解决?
一些尝试:
电视post-main-image
的输出是否设置为文本? (我假设是。)
在您的模板示例中,当您在 w=360
之前添加一个符号 &
时会发生什么?
[[*post-main-image:phpthumbof=`&w=360&h=223&zc=1`]]
您可以使用 phpThumbOf 作为代码片段而不是输出修饰符:
[[!phpthumbof? &input=`[[+post-main-image]]` &options=`&w=360&h=223&zc=1`]]
(未经测试)
您可以改用 pThumb(我的运气要好得多)。 https://github.com/rthrash/pThumb
我在网站的不同部分使用 phpthumbof 来调整图像大小
它使用模板中的 pdoresources 在块中完美运行
[[pdoResources?
&parents=`2`
&limit=`1`
&depth=`2`
&hideContainers=`1`
&includeTVs=`post-main-image`
&tpl=`main-post`
]]
这里是块的代码:
<img src="[[+tv.post-main-image:phpthumbof=`w=360&h=223&zc=1`]]">
但是当我直接从模板调用它时它不起作用
[[*post-main-image:phpthumbof=`w=360&h=223&zc=1`]]
它显示图像但不影响它的大小或裁剪。我该如何解决?
一些尝试:
电视post-main-image
的输出是否设置为文本? (我假设是。)
在您的模板示例中,当您在 w=360
之前添加一个符号 &
时会发生什么?
[[*post-main-image:phpthumbof=`&w=360&h=223&zc=1`]]
您可以使用 phpThumbOf 作为代码片段而不是输出修饰符:
[[!phpthumbof? &input=`[[+post-main-image]]` &options=`&w=360&h=223&zc=1`]]
(未经测试)
您可以改用 pThumb(我的运气要好得多)。 https://github.com/rthrash/pThumb