0

我正在使用干预图像来调整图像大小,然后将其保存到目标文件夹。但它不适合我。我收到诸如“图像源不可读”之类的错误。请看下面的代码:

 $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 );
}
4

1 回答 1

0

您需要给出图像的名称:

if ($upload_success) {
Image::make($file->getRealPath())->fit('120','120')->save($thumbdestinationPath . $image_name );
}
于 2016-07-01T08:48:15.333 回答