alexusmai / laravel-file-manager

File manager for Laravel
MIT License
1.13k stars 290 forks source link

Google Cloud Storage #343

Open longthoughtsolutions opened 1 year ago

longthoughtsolutions commented 1 year ago

I am trying to implement file-manager but using a GCS disk and I am getting the file listing but no preview image If I choose properties from the mini-menu and click "Get URL" I do get the correct url but the preview is not showing the bucket's url.

I have added the gcs to filesystems:

    'gcs' => [
        'url' => 'https://storage.googleapis.com/bucket-name',
        'driver' => 'gcs',
        'key_file_path' => base_path(env('GOOGLE_CLOUD_KEY_FILE', null)), // optional: /path/to/service-account.json
        'key_file' => [], // optional: Array of data that substitutes the .json file (see below)
        'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'your-project-id'), // optional: is included in key file
        'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', 'your-bucket'),
        'path_prefix' => env('GOOGLE_CLOUD_STORAGE_PATH_PREFIX', ''), // optional: /default/path/to/apply/in/bucket
        'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', null), // see: Public URLs below
        'apiEndpoint' => env('GOOGLE_CLOUD_STORAGE_API_ENDPOINT', null), // set storageClient apiEndpoint
        'visibility' => 'public', // optional: public|private
        'visibility_handler' => null, // optional: set to \League\Flysystem\GoogleCloudStorage\UniformBucketLevelAccessVisibility::class to enable uniform bucket level access
        'metadata' => ['cacheControl'=> 'public,max-age=86400'], // optional: default metadata
    ],

I am obviously doing something wrong but can not figure out what nor can I find any documentation or examples of using this page with the cloud disk.
In case it matters I am using "alexusmai/laravel-file-manager": "^3.0", "spatie/laravel-google-cloud-storage": "^2.2", Laravel 9