Aliyun-oss-storage icon indicating copy to clipboard operation
Aliyun-oss-storage copied to clipboard

ErrorException In AliOssAdapter.php line 570

Open xinliang9527 opened this issue 6 years ago • 9 comments

image

public function getUrl( $path ) { if (!$this->has($path)) throw new FileNotFoundException($filePath.' not found'); //这句报错了,FileNotFoundException没有找到 2$filePath 没有定义 return ( $this->ssl ? 'https://' : 'http://' ) . ( $this->isCname ? ( $this->cdnDomain == '' ? $this->endPoint : $this->cdnDomain ) : $this->bucket . '.' . $this->endPoint ) . '/' . ltrim($path, '/'); }

xinliang9527 avatar Nov 03 '18 07:11 xinliang9527

我也遇到这个问题了; Class 'Symfony\Component\Filesystem\Exception\FileNotFoundException' not found /vendor/jacobcyl/ali-oss-storage/src/AliOssAdapter.php 570行

setwang avatar Dec 04 '18 02:12 setwang

同,请问解决了吗?

Rotor1996 avatar Feb 14 '19 04:02 Rotor1996

同,请问解决了吗?

注释掉 570行代码,不检查文件是否存在

cqbaixin avatar Apr 02 '19 15:04 cqbaixin

检查路径是否有问题,比如多个“/”

jackcoco avatar May 30 '19 06:05 jackcoco

这个建议作者去掉 has($path) 的判断。 因为图片或内容不存在就抛出异常,太不友好了。 数据量大也影响访问。

cntnn11 avatar Aug 26 '19 02:08 cntnn11

同问,这个有更新解决吗?

SamHz avatar May 04 '20 05:05 SamHz

同问,这个有更新解决吗?

colinjuang avatar Jun 20 '20 08:06 colinjuang

查看返回url地址是否多了「/」 form->image('column', __('图片'))->move("xxx/xxx"); 最后不要带「/」,否则上传oss成功后,查看时报错

xuan1118 avatar Aug 19 '20 15:08 xuan1118


\Encore\Admin\Grid\Column::extend('image', \App\Admin\Extensions\MyImage::class);


class MyImage extends AbstractDisplayer
{
    public function display($server = '', $width = 200, $height = 200)
    {
        if ($this->value instanceof Arrayable) {
            $this->value = $this->value->toArray();
        }

        return collect((array) $this->value)->filter()->map(function ($path) use ($server, $width, $height) {
            if (url()->isValidUrl($path) || strpos($path, 'data:image') === 0) {
                $src = $path;
            } elseif ($server) {
                $src = rtrim($server, '/').'/'.ltrim($path, '/');
            } else {
                //自定义方法添加路由
                $src = getOssUrl($path);
            }

            return "<img src='$src' style='max-width:{$width}px;max-height:{$height}px' class='img img-thumbnail' />";
        })->implode('&nbsp;');
    }
}

yljphp avatar May 13 '21 08:05 yljphp