简体   繁体   English

TYPO3流体:f:图像修剪图像,然后缩放

[英]TYPO3 Fluid: f:image trim image then scale

I have a square image of 1200x1200px. 我有一个1200x1200px的正方形图像。 Now I want to cut off / trim all sides by 80px and then scale it down to 275px. 现在,我想将所有边都剪下/修剪80px,然后将其缩小到275px。 How is this possible? 这怎么可能?

<f:image src="path/to/image.jpg" width="275c" />

This just scales down the image, so I took a look at the imgResource Core Documentation that told me, you can crop images by substracting x percent. 这只是按比例缩小图像,因此我看了看imgResource Core文档 ,该文档告诉我,您可以通过减去x百分比来裁剪图像。

<f:image src="path/to/image.jpg" width="1120c-93" height="1120c-93" />

93% of 1200px are roughly 1120px. 1200像素的93%约为1120像素。

Next try was to first crop, then scale, but it seems that I'm not able to trim a square image at all. 下一步尝试是先裁剪,然后缩放,但似乎根本无法修剪正方形图像。

<f:image src="{f:uri.image(src: 'path/to/image.jpg', width: '1200c-93')}" width="275" />

Does anyone have any suggestions how to solve the problem? 有人对解决问题有任何建议吗?

Edit 编辑

So I tried the following with fixed width and height: 因此,我尝试使用固定的宽度和高度进行以下操作:

<f:image src="{f:uri.image(src: '{item.imagePath}image_001.jpg', width: '1120c-50', height: '1120c-50')}" width="275" height="275" alt="{item.name}" />
<f:image src="{item.imagePath}image_001.jpg" alt="{item.name}" width="275" alt="{item.name}" />

But this gives me two identical images: http://img545.imageshack.us/img545/204/nsuo.png 但这给了我两个相同的图像: http : //img545.imageshack.us/img545/204/nsuo.png

You have to specify an explicit height in the inner call and the crop values must be smaller than the original image size. 您必须在内部调用中指定一个明确的height ,并且裁切值必须小于原始图像的大小。 So try this one: 所以试试这个:

<f:image src="{f:uri.image(src: 'path/to/image.jpg', width: '1120c-93', height: '1120c-93')}" width="275" alt="" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM