Typo3流体图像作物的高度和失败 [英] Typo3 Fluid Image crop of with and height failure

查看:134
本文介绍了Typo3流体图像作物的高度和失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此代码:

 < f:image src =/ uploads / extkey / {image}alt = width =115cheight =70c/> 

生成以下HTML输出:

 < img src =typo3temp / _processed_ / csm_testimage_31f6051846.gifwidth =115height =92alt => 



现在图片高度错了,顶部和底部都有白条。我发现92来自它的比例(原始图像是:1280×1024)。我猜如果顶部和底部的白色条被切掉,70的高度将会被达到。任何想法为什么Typo3做错了,并在这里有一些其他人有相同的问题?



使用Typo3 6.1.5
ImageMagick 6



编辑#2:
尝试了不同的宽度,高度,裁切,最大宽度,最大高度的组合:

 < f:image src =/ uploads / extkey / {image}alt =width =115height =70cmaxHeight =70/ > 

结果/失败为:


  • 图像不是115x70

  • 图像变形


解决方案

我发现了这个Bug的正确解决方案。它现在已经4岁多了,仍然没有固定。该文件和该行已更改为:/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php,行:2315



http://forge.typo3.org/issues/19045



t3lib / class.t3lib_stdgraphic.php
行2181(在版本4.2.6中)

将行改为
$ data ='-crop'。$ data ['origW']。'x'。$ data ['origH']。'+'。$ offsetX。'+'。$ offsetY。'! ';



我刚加了!最后它现在起作用 - !之后裁剪命令告诉imagemagick调整画布和视口。

未使用任何其他安装而不是我正在使用的安装(4.2.6与IM 6.3.7),所以有人应该做这个之前,这个修复程序被提交到核心。


Using this code:

<f:image src="/uploads/extkey/{image}" alt="" width="115c" height="70c" />

Produces following HTML output:

<img src="typo3temp/_processed_/csm_testimage_31f6051846.gif" width="115" height="92" alt="">

The image has a wrong height now and there are white bars at top and bottom. I figured out that "92" comes from its proportion (original image is: 1280 × 1024). I guess if the white bars at top and bottom are cut out the height of 70 will be reached. Any ideas why Typo3 is doing that wrong and does some others here having the same problem?

Using Typo3 6.1.5 ImageMagick 6

EDIT #2: Tried different combinations with width,height,crop,maxWidth,maxHeight like:

<f:image src="/uploads/extkey/{image}" alt="" width="115" height="70c" maxHeight="70" />

The results/fails are:

  • Image is not 115x70
  • Image is deformed

解决方案

I have found the correct solution for this Bug. Its now more then 4 years old and still not fixed. The file and the line has changed to: /typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php , Line: 2315

http://forge.typo3.org/issues/19045

t3lib/class.t3lib_stdgraphic.php line 2181 (in version 4.2.6 that is)

adapt line to $params .= ' -crop '.$data['origW'].'x'.$data['origH'].'+'.$offsetX.'+'.$offsetY.'! ';

I just added the "!" at the end and it now works - "!" after the crop command tells imagemagick to adjust canvas and viewport.

Didn't test this with any other installations than the one I'm working on right now (4.2.6 with IM 6.3.7), so somebody should probably do this before this fix is commited into core.

这篇关于Typo3流体图像作物的高度和失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆