通过向 templavoila 添加打字稿,使用 timthumb 缩小图像(数据处理)
我想要两种不同的图像大小:一种用于普通浏览器,一种用于移动版本。我想我可以使用 timthumb 来调整图像大小。
因此,我在 Templavoila 中映射了一个 Image 字段,将 W+H
固定为
。在数据处理
下,我想输入我的Typoscript代码。通过这段代码,我想要另一种表示(缩放图像)。
10 = IMAGE
10.file.XY = 1328,768
10.file.import = uploads/tx_templavoila/
10.file.import.current = 1
10.file.import.listNum = 0
10.file.maxW = 2000
10.file.minW = 1000
10.file.maxH = 1000
10.file.minH = 700
[globalVar = TSFE:fe_user|sesData|mobileversion=1]
20 = RECORDS
20.source.current = 1
20.tables = tt_content
20.stdWrap.wrap = <img src="fileadmin/templates/php_scripts/timthumb.php?src=|&w=600" />
20.stdWrap.required = 1*
[global]
但我总是从普通版本得到图片。我尝试使用会话变量,也尝试使用用户函数。即使我删除这个条件,输出也总是相同的......(大图)。我做错了什么?
I want to have two different image sizes: One for the normal browser and one for the mobile version. I thought I could use timthumb to resize the image.
Therefore I mapped in Templavoila an Image field, fixed W+H
to an <img src="xx" />
. Under Data processing
I want to enter my Typoscript code. With this code I want to have another representation (scaled image).
10 = IMAGE
10.file.XY = 1328,768
10.file.import = uploads/tx_templavoila/
10.file.import.current = 1
10.file.import.listNum = 0
10.file.maxW = 2000
10.file.minW = 1000
10.file.maxH = 1000
10.file.minH = 700
[globalVar = TSFE:fe_user|sesData|mobileversion=1]
20 = RECORDS
20.source.current = 1
20.tables = tt_content
20.stdWrap.wrap = <img src="fileadmin/templates/php_scripts/timthumb.php?src=|&w=600" />
20.stdWrap.required = 1*
[global]
But I always get the picture from the normal version. I tried to use the session variable and I also tried to use a user function. Even if I remove this condition the output is always the same... (big picture). What I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
TYPO3 能够开箱即用地调整图像大小。您不需要额外的脚本。
将其放入您的主模板中,其中 page.10 < plugin.tx_templavoila 定义:
第 1 页 = LOAD_REGISTER
page.1.mobileversion = 0
更改您的代码:
当然未经测试,但即使与 TemplaVoila 一起使用也应该可以工作。
如果您使用的是 GIFBUILDER.IMAGE-Object (因为您使用的是
10.file.XY
),您需要像这样更改代码:但我猜,您混淆了 GIFBUILDER.IMAGE 和 图像。
TYPO3 is able to resize your images out of the box. You do not need an additional script.
Put this in your Main-Template, where page.10 < plugin.tx_templavoila is defined:
page.1 = LOAD_REGISTER
page.1.mobileversion = 0
Change your code:
For sure untested, but it should work even with TemplaVoila.
If you are using GIFBUILDER.IMAGE-Object (because you are using
10.file.XY
) you need to change your code like this:But i guess, you mixed up GIFBUILDER.IMAGE and IMAGE.
下面由 Dmitry Dulopev 发表的几篇文章讨论了如何使用 Templa Voilla 来添加移动模板。这就是你所追求的吗?
http://www.dmitry-dulepov .com/2009/04/creating-mobile-version-of-web-site.html
The below post from Dmitry Dulopev whilst a couple of years old now talks about how you can use Templa Voilla to add a mobile template as well. Is this what you were after?
http://www.dmitry-dulepov.com/2009/04/creating-mobile-version-of-web-site.html
这些类型的条件(
[global]
等)在电视数据结构中还不起作用。但是您也许可以使用“注入”到数据结构中的常量结合
stdWrap
条件来解决这个问题。您可以在常规 TypoScript 设置中设置 TV 常量,如下所示
: 当然,这里您也可以使用条件:
现在,在 TV 字段的 TypoScript 数据处理中,您可以执行以下操作:
一些注释/问题:
20
甚至可以在电视领域进行处理。我认为它只查找10
。IMAGE
cObject?IMG_RESOURCE
。它允许您仅使用图像 URL 而不是整个元素标签。稍后,您可能会比使用RECORDS
中的内容更容易理解它。免责声明:尚未测试上述内容,因此请注意拼写错误或类似情况。 (我当然在项目中使用了该方法。)
Those kind of conditions (
[global]
etc.) don't yet work in TV data structures.But you might be able to work your way around that using constants that you "inject" into the datastructure in combination with
stdWrap
conditions.You can set TV constants in your regular TypoScript setup like that:
Here you can also use conditions, of course:
Now, in the TypoScript data processing of your TV field, you can do this:
A few notes/questions:
20
even gets processed in a TV field. I think it only looks for10
.IMAGE
cObject?IMG_RESOURCE
. It lets you work with just the image URL instead of the whole element tag. Later it might be easier to wrap your head around that than with theRECORDS
stuff you have there.Disclaimer: Haven't tested the above, so beware of typos or things like that. (I of course used the method in projects.)