TYPO3 crop image in fluid

夙愿已清 提交于 2019-12-25 02:33:21

问题


I have croped image in BE. And how to show croped image in the fluid?

I have crope field:

crop => '{"default":{"cropArea":{"height":0.24482758620689654,"width":0.4379310344827
         586,"x":0,"y":0.5586206896551724},"selectedRatio":"16:9","focusArea":null}}' (151 chars)

I tried in fluid:

<f:image image="{file}" crop="{file.crop}" class="main-img"/>

Thank a lot in advance!


回答1:


As I know you dont need to tell the f:image ViewHelper anything about the cropping if you only use the default cropvariant. But I had some problems with Mittwald hosted websites - the GraphicsMagick version there was not able to crop somehow (on other Mittwald hosted sites it worked witht the same GM version). So I just switched to ImageMagick on the sites which had problems with cropping in the frontend and then it worked. If there is a problem with GM and cropping, default Content Elements won't even show the cropped variant in backend preview (Text and Media Elements)




回答2:


The crop attribute is meant for manual cropping of images. What you are looking for is the cropVariant attribute. If you did not add any crop variants yourself, you will most likely at least have the default crop variant, so your snippet should look like this:

<f:image image="{file}" cropVariant="default" class="main-img"/>

For every additional crop variant you add another <f:image/> to render the image for that crop variant.



来源:https://stackoverflow.com/questions/50293342/typo3-crop-image-in-fluid

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!