我正在使用laravel从我们合作伙伴的网站上抓取图片,这是代码:
protected function generateImages($image, $fullPath)
{
$thumbs = Attachment::getThumbs();
$tmp = Image::make(file_get_contents($image))->encode('jpg', 40);
foreach ($thumbs as $thumb => $data) {
if ($data['method'] === 'fit') {
$tmp->fit($data['width'], $data['height'], function ($constraint) {
// $constraint->upsize();
$constraint->aspectRatio();
});
} elseif ($data['method'] === 'resize') {
$tmp->resize($data['width'], $data['height'], function ($constraint) {
$constraint->upsize();
$constraint->aspectRatio();
});
}
$tmp->save($fullPath . $data['path']);
}
$tmp->destroy();
}
但它返回底部带有灰线的图像。
更新: 图片示例:IMAGE LINK
我尝试将 - >编码(' jpg',40)更改为png / gif / jpeg,并尝试了30/50/100的质量,但没有...