TYPO3产生不同尺寸的图像 [英] TYPO3 Produce images in different sizes
问题描述
我有此实现,可在第2级页面子菜单中使用它.每个2级菜单都有多个子页面.每个子页面都有一个图像.因此,此实现会为每个子菜单从每个页面生成一个图像.例如,一个包含2个子页面的子菜单将具有2张图像(每个子页面一个图像).
I have this implementation, using it in a page level 2 submenu. Each level 2 menu has multiple subpages. Each subpage has one image. So this implementation produces an image from each page for each submenu. For example, a submenu with 2 subpages will have 2 images (one from each subpage).
1 = FILES
1 {
references {
table = pages
fieldName = media
data = levelmedia:-1, slide
}
begin = 0
maxItems = 2
renderObj = COA
renderObj {
2 = IMAGE
2 {
file {
//params = -sharpen 50 +profile "*" -quality 100
import.data = file:current:uid
treatIdAsReference = 1
width.optionSplit = 300c|*|400c
height.optionSplit = 350c|*|450c
}
}
}
}
希望将图像裁切成不同的大小,以便将图像1裁切成与图像2不同的尺寸,依此类推.
Would like to have images cropped in different sizes such that image 1 is cut to different dimensions from image 2 and so on.
我的ImageMagick安装可完美运行.实际上是用它毫无障碍地裁剪单个图像.
My ImageMagick installation works perfectly. Am actually cropping single images with it without a hitch.
如果没有上面的optionSplit
,图像将被正确地切成大小.不幸的是,使用optionSplit
只能输出原始尺寸的图像.
Without the optionSplit
above, the images are cut to size nicely. Unfortunately with the optionSplit
it simply outputs the images in their original sizes.
如何产生不同的图像尺寸?我的理解是,optionSplit
是解决方法(来自手册).我读过一些文章,其中soureCollection
用于响应图像使用optionSplit
.我想象另一种方式是使用图像注册计数器并使用CASE来确定如何剪切图像1、2、3等,但是不熟悉注册计数器(也许有人可以向我展示如何执行此操作?).还有另一种方法是使用文件/图像索引号,但是我尝试了数小时的手册来查找这样的指针,并且如果有任何帮助的地方,它在任何地方都没有列出.有人知道这样做的方法吗?
How can I produce different image sizes? My understanding is that optionSplit
is the way to go (from the manuals). I read in articles that soureCollection
for responsive images use optionSplit
. I imagine another way would be to use an image register counter and use CASE to determine how to cut image 1, 2, 3 and so on, but am not familiar with register counters (maybe someone can show me how to do this?). And yet another way would be to use a file/image index number but I've tried looking at the manuals for hours for such a pointer and nowhere is it listed if there's any to help with processing. Anybody know a way to do this?
推荐答案
在打字稿中很难渲染两个具有不同参数的连续图像:
您的optionsplit不能成功,因为在renderObj中您始终只有一个文件.所有renderObj
的坏习惯.
rendering two consecutive images with different paramters will be difficult in typoscript:
your optionsplit can not success as in the renderObj you always have only one file. A bad habit of all renderObj
.
:没有属性optionSplit
.该功能是在任何wrap属性中构建的.
on the other hand: there is no property optionSplit
. the functionality is build in any wrap property.
因此,打字稿中的处理方法是将元素连接起来,然后再次拆分它们,然后在拆分的renderObj中使用不同的选项来分别处理它.
或使用寄存器变量实现计数器,然后评估寄存器以设置不同的值.
therefore a handling in typoscript could be to concatenate the elements, then split them again, but then use different options in the split renderObj to handle it separately.
or implement a counter with a register variable, then evaluate the register to set different values.
更容易处理,可以在f:for
viewhelper中使用迭代器,然后在{iterator.index}
上执行f:if
(对于两种情况)或f:switch
(对于更多情况).呈现单个版本.
easier would be a handling in fluid, where you could use an iterator with the f:for
viewhelper, and then do an f:if
(for two cases) or an f:switch
(for more cases) on {iterator.index}
to render individual versions.
这篇关于TYPO3产生不同尺寸的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!