Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorException In AliOssAdapter.php line 570 #65

Open
xinliang9527 opened this issue Nov 3, 2018 · 9 comments
Open

ErrorException In AliOssAdapter.php line 570 #65

xinliang9527 opened this issue Nov 3, 2018 · 9 comments

Comments

@xinliang9527
Copy link

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
Copy link

setwang commented Dec 4, 2018

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

@Rotor1996
Copy link

同,请问解决了吗?

@cqbaixin
Copy link

cqbaixin commented Apr 2, 2019

同,请问解决了吗?

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

@jackcoco
Copy link

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

@cntnn11
Copy link

cntnn11 commented Aug 26, 2019

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

@SamHz
Copy link

SamHz commented May 4, 2020

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

1 similar comment
@colinjuang
Copy link

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

@xuan1118
Copy link

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

@yljphp
Copy link

yljphp commented May 13, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants