こんにちは、laravel5 を使用してファイルをアップロードしました。そのURLを取得しますか?
dd(Flysystem::get('avatars/kenshin.jpg'));
imgsrc の URL はどこですか?
Assuming you already created a service provider for custom filesystem.
If you don't know how to do that the doc is Here
Route::get('/dropbox',function()
{
$filename = '/text1.txt';
$adapter = \Storage::disk('dropbox')->getAdapter();
$client = $adapter->getClient();
$link = $client->createTemporaryDirectLink($filename);
return <<<EOT
<a href="{$link[0]}">Link</a>
EOT;
});
PLEASE NOTE THAT you have to prefix a "\" slash on the filename or else it will thrown an exception.
コントローラーでメソッドの別のルートを作成し、ドロップボックスからアクセスするファイル名をルートで渡します。コントローラーで getFile() メソッドを使用し、ファイル名を変数に渡します。
public function getFile($file_name)
{
$client = new Client('dropbox.token','dropbox.appName');
$this->filesystem = new Filesystem(new Dropbox($client, '/path'));
try{
$file = $this->filesystem->read($file_name);
}catch (\Dropbox\Exception $e){
return Response::json("{'message' => 'File not found'}", 404);
}
$response = Response::make($file, 200);
return $response;
}