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

Elfinder connect to GCS #55

Open
richseyha opened this issue Dec 15, 2016 · 5 comments
Open

Elfinder connect to GCS #55

richseyha opened this issue Dec 15, 2016 · 5 comments

Comments

@richseyha
Copy link

I am trying to make a connection between Eflinder and my GCS Buckets but I don't know how to do it and I can not found a good solutions.

Please help to solve my problem or give me the solution....!

Thanks in advance for your help...

Best Regards,

@barryvdh
Copy link
Owner

@richseyha
Copy link
Author

richseyha commented Dec 16, 2016 via email

@paulcanning
Copy link

Setup the GCS flysystem, then add it as a root volume in elFinder

'roots' => [
				[
					'driver' => 'Flysystem',
					'filesystem' => $this->_google_cloud_storage($project_name),
                                 ]
]
private function _google_cloud_storage($bucket)
	{
		$storageClient = new StorageClient([
			'projectId' => $project_id,
			'keyFilePath' =>$keyfile
		]);
		$bucket = $storageClient->bucket($bucket);
		$adapter = new GoogleStorageAdapter($storageClient, $bucket);

		return new Filesystem($adapter);
	}

@ihsanberahim
Copy link

ihsanberahim commented Aug 4, 2018

i use helper instead of $this->_google_cloud_storage

function elfinder_gcs($project_id, $bucket, $key_file) {
    $storageClient = new StorageClient([
        'projectId' => $project_id,
        'keyFilePath' => $key_file
    ]);
    $bucket = $storageClient->bucket($bucket);
    $adapter = new GoogleStorageAdapter($storageClient, $bucket);

    return new Filesystem($adapter);
}

So, my elfinder.php

    'roots' => [
        [
            'driver' => 'Flysystem',
            'filesystem' => elfinder_gcs(env('GCS_PROJECT_ID'), env('GCS_STORAGE_BUCKET'),
                app_path(
                    '../'.env('GCS_KEY_FILE')
                )
            ),
        ]
    ],

If facing issue where the file not publicly accessible, here is my temporary solution

Thank you @paulcanning

@boris-brtan
Copy link

boris-brtan commented Apr 3, 2019

Hi @barryvdh,
is there an easy way how to extend the Driver ? I would like to implement thumbnails methods to use google cloud bucket path.
i use also https://github.com/Superbalist/flysystem-google-cloud-storage

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

5 participants