干预图像在调整大小时降低图像质量

Intervention Image degrades quality of image on resize

我正在使用 Intervention Image 上传单个图像的两个版本(小的和大的)以显示在不同的页面上。

用户总是上传 1000 x 1000 像素的图片,原始图片用于单个产品的产品页面,较小的版本用于 'all products' 页面。

这工作正常,但被缩小的图像质量很差。它是像素化的。

我正在使用 Laravel 4.2。我的 php 版本是 5.5.11。我正在本地主机上使用 Xampp 进行开发。我查看了 this question 并且我很确定 GD 已安装。

难道是因为GD不如imagick?因为我似乎一辈子都无法安装那个东西...

编辑:这 的问题!我终于设法让 imagick 工作并将其更改为驱动程序。高质量的图像。

这是我的路线,但我不认为这是问题所在:

$file = Input::file('photo');
$fileName = Input::get('name').'.'.$file->getClientOriginalExtension();
$fileName= str_replace(' ', '_', $fileName);
$destinationPath    = 'productphotos/';

// upload new image
Image::make($file->getRealPath())
// original
->save($destinationPath.$fileName)
// resize
->resize(300, 300) // set true if you want proportional image resize
->save($destinationPath.'resize'.$fileName, 100);



    $aDetails = Input::all();
    $aDetails["photo"] = $fileName;
    $aDetails["smallphoto"] = 'resize'.$fileName;
    Product::create($aDetails);

    return Redirect::to("products/".Input::get("product_id"));

您可以看到库存测试(原始尺寸 1000x1000)和 testresize(300x300) 之间的区别。它们都以 218x218 显示。

我终于设法让 imagick 工作并将其更改为驱动程序。高质量的图像。 GD 驱动是问题所在,解决方法是换成 imagick 驱动。 干杯!