作者:五月妖精23 | 来源:互联网 | 2023-10-10 07:35
篇首语:本文由编程笔记#小编为大家整理,主要介绍了PHP在symfony下修改ImageMagicksfThumbnail插件相关的知识,希望对你有一定的参考价值。
篇首语:本文由编程笔记#小编为大家整理,主要介绍了PHP 在symfony下修改ImageMagick sfThumbnail插件相关的知识,希望对你有一定的参考价值。
Change lines 223-237:
$width = $this->sourceWidth;
$height = $this->sourceHeight;
$x = $y = 0;
switch (@$this->options['method']) {
case "shave_all":
if ($width > $height)
{
$x = ceil(($width - $height) / 2 );
$width = $height;
}
elseif ($height > $width)
{
$y = ceil(($height - $width) / 2);
$height = $width;
}
to:
$width = $this->sourceWidth;
$height = $this->sourceHeight;
$mWidth = $this->maxWidth;
$mHeight = $this->maxHeight;
$x = $y = 0;
switch (@$this->options['method']) {
case "shave_all":
if ($width > $height)
{
$x = ceil(($width - ($height*$mWidth)/$mHeight) / 2 );
$width = $height;
}
elseif ($height > $width)
{
$y = ceil(($height - $width*($mHeight/$mWidth)) / 2);
$height = $width;
}