jacobcyl / Aliyun-oss-storage

阿里云OSS laravel storage Filesystem adapter, 打造Laravel最好的OSS Storage扩展.
http://jacobcyl.github.io/Aliyun-oss-storage/
MIT License
522 stars 161 forks source link

ErrorException In AliOssAdapter.php line 570 #65

Open xinliang9527 opened 5 years ago

xinliang9527 commented 5 years ago

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, '/'); }

setwang commented 5 years ago

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

Rotor1996 commented 5 years ago

同,请问解决了吗?

cqbaixin commented 5 years ago

同,请问解决了吗?

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

jackcoco commented 5 years ago

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

cntnn11 commented 5 years ago

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

SamHz commented 4 years ago

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

colinjuang commented 4 years ago

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

xuan1118 commented 4 years ago

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

yljphp commented 3 years ago

\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;');
    }
}