2017-07-17 135 views
0

我有我使用下面的代码来调整图像中laravel缩放图像5.4Laravel 5.4图像大小调整问题

一个问题:

$sample_front_image = $request->file('sample_front_image'); 
    $input['sample_front_image'] = $sample_front_image->getClientOriginalName(); 
    $image_resize = Image::make($sample_front_image->getRealPath());    
    $image_resize->resize(120, 120); 
    $image_resize->save(public_path($thumbnail_dir, $input['sample_front_image'])); 

但我收到以下错误如下表: enter image description here

上面的代码似乎对以前的laravel版本正常工作,但不适用于5.4版本。任何方案?

回答

1

这是因为干预是不是能找到你正在传递它调整图像大小。您正在向Image :: make()提供临时图像路径,而不是实际路径。

所以首先你要像使用存储()上传到某个地方,然后需要提供的图片是图片的完整路径::使()。

希望这会有所帮助。