Symfony 使用带有Google CloudStorage adapter的KnpGaufretteBundle检索公共路径

Symfony 使用带有Google CloudStorage adapter的KnpGaufretteBundle检索公共路径,symfony,google-cloud-storage,gaufrette,Symfony,Google Cloud Storage,Gaufrette,在使用GoogleCloudStorage adapter设置了KnpGaufretteBundle之后,我能够在GoogleCloudStorage中编写文件 但我不知道如何检索该文件的公共访问链接(本例中为图像) 下面是我用来编写的代码的一个示例,如果它与其他方面相关的话。事实上,我必须: $fs = $this->get("knp_gaufrette.filesystem_map")->get("bucket_name"); $fs->write("image.jpg",

在使用GoogleCloudStorage adapter设置了KnpGaufretteBundle之后,我能够在GoogleCloudStorage中编写文件

但我不知道如何检索该文件的公共访问链接(本例中为图像)

下面是我用来编写的代码的一个示例,如果它与其他方面相关的话。事实上,我必须:

$fs = $this->get("knp_gaufrette.filesystem_map")->get("bucket_name");
$fs->write("image.jpg",file_get_contents("/path/to/file"));

关于如何找回公众的任何想法(“http://..)从这里开始的url


谢谢

看看Gaufrete Extra()。
您应该能够通过复制他们为AmazonS3所做的方式轻松实现它。最后,我可以通过编程获得url

首先,我必须像这样公开这个桶:

然后我得到了下面这篇文章的url:

$file = new \Gaufrette\File("image.jpg",$this->get("knp_gaufrette.filesystem_map")->get("bucket_name"));
$file->setContent(file_get_contents("/path/to/file"));