使用laravel 5中的干预调整图像大小错误

时间:2016-07-01 08:30:35

标签: laravel intervention

我正在使用干预图像来调整图像大小,然后将其保存到目标文件夹。但它不适合我。我收到错误,"图像源不可读"。 请参阅以下代码:

 $image_name = $file->getClientOriginalName();
 $thumbName      =   'thumb_'.  $image_name;
 $destinationPath = public_path() . '/uploads/';
 $thumbdestinationPath = public_path() . '/uploads/thumbnails/';
 $imgUrl = URL::to('/').'/public/uploads/'.$image_name;
 $thumbUrl = URL::to('/').'/public/uploads/thumbnails/'.$image_name;

  $upload_success = $file->move( $destinationPath, $image_name);
if ($upload_success) {
Image::make($file->getRealPath())->fit('120','120')->save($thumbdestinationPath );
}

1 个答案:

答案 0 :(得分:0)

您需要提供图片名称:

if ($upload_success) {
Image::make($file->getRealPath())->fit('120','120')->save($thumbdestinationPath . $image_name );
}