Gettign错误:在Laravel中无法读取图像源

问题描述 投票:1回答:2

我已成功上传图片。但是在尝试上载图片之前调整大小时遇到​​错误。

干预\图像\异常\ NotReadableException图片来源不可读

Controller.php

        $image=$request->product_image; 
        $thumbnailSize = '150X150';

        $upload_path='image/product/'.$request->product_name.'/';           

        $imageName = $request->product_name.time().'.'.$image->getClientOriginalExtension();

        $thumbnailImageName = $request->product_name.time().'.'.$image->getClientOriginalExtension().$thumbnailSize;

        $image_url = $upload_path.$imageName;

        $thumbnail_image_url = $upload_path.$thumbnailImageName;

        $image->move(storage_path($upload_path), $imageName);

        $resize_image = Image::make($image->getRealPath());

        $resize_image->resize(150, 150, function($constraint){
        $constraint->aspectRatio();
        })->save($upload_path);

我还用"intervention/image": "dev-master"中的config/app.php更新了作曲家>

[有人帮忙吗?预先感谢。

我已成功上传图片。但是在尝试上载图像之前调整大小时遇到​​错误。干预\图像\异常\ NotReadableException图像源不可读...

php laravel image-resizing laravel-5.8
2个回答
1
投票

在表单标签中添加以下参数:


0
投票

尝试此代码

© www.soinside.com 2019 - 2024. All rights reserved.