CKFinder-将图像切割成指定尺寸

时间:2019-04-03 12:34:03

标签: javascript php jquery laravel ckfinder

当我在CKFinder中上传图片时,我希望该图片为830x421px。但是由于某些原因,图像没有被裁剪为这些尺寸。而是自动将高度或宽度设置为830px421px ...所以问题是:我该如何切割CKFinder将图像调整为这些尺寸,而不是调整大小...?似乎存在某种我无法找到/定位的长宽比?

$config['images'] = array(
    'maxWidth'  => 830,
    'maxHeight' => 421,
    'quality'   => 80,
    'sizes' => array(
        'small'  => array('width' => 182, 'height' => 120, 'quality' => 80),
        'medium' => array('width' => 341, 'height' => 225, 'quality' => 80),
        'large'  => array('width' => 830, 'height' => 421, 'quality' => 80)
    )
);

1 个答案:

答案 0 :(得分:0)

如果您查看ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\Image.php,您会发现resize方法(当然是用于调整图像的大小)实际上是对calculateAspectRatio方法的硬编码调用(在第549行附近)。看来您是对的,确实存在内部长宽比。不幸的是,我也看不到任何方法可以从外部禁用它。

相关问题