elfinder-flysystem-driver icon indicating copy to clipboard operation
elfinder-flysystem-driver copied to clipboard

Elfinder connect to GCS

Open richseyha opened this issue 8 years ago • 5 comments

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,

richseyha avatar Dec 15 '16 09:12 richseyha

Did you use https://github.com/Superbalist/flysystem-google-cloud-storage

barryvdh avatar Dec 16 '16 07:12 barryvdh

I checked it already but I don't know to how to configure with Elfinder connector. If you have any idea please guide me.

Thanks in advance!

Seyha

On Fri, Dec 16, 2016 at 2:48 PM, Barry vd. Heuvel [email protected] wrote:

Did you use https://github.com/Superbalist/flysystem-google-cloud-storage

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/barryvdh/elfinder-flysystem-driver/issues/55#issuecomment-267536709, or mute the thread https://github.com/notifications/unsubscribe-auth/ARzj2-DGJsd9MoEBSqKXdVthOW9WdX8iks5rIkJkgaJpZM4LN5I8 .

-- Mr Chroeng Seyha Sangkat Chorm Chao, Khan Por Sen Chey No. 11GE, st. 210 Phnom Penh M: +855 96 58 57 068 E: [email protected]

richseyha avatar Dec 16 '16 17:12 richseyha

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

paulcanning avatar Apr 12 '17 16:04 paulcanning

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

ihsanberahim avatar Aug 04 '18 15:08 ihsanberahim

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

boris-brtan avatar Apr 03 '19 06:04 boris-brtan