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

Working config for Laravel+elfinder+S3+Glide #60

Open
delatbabel opened this issue Jun 27, 2017 · 5 comments
Open

Working config for Laravel+elfinder+S3+Glide #60

delatbabel opened this issue Jun 27, 2017 · 5 comments

Comments

@delatbabel
Copy link
Contributor

Hi, more a question or set of questions than an issue.

Like a lot of people I guess I have a combination of requirements including Laravel app + elfinder + S3 storage + Glide.

I have most of it working. My config files look like this:

config/filesystems.php

return [
    'default' => 's3',
    'cloud' => 's3',
    'disks' => [
        's3' => [
            'driver' => 's3',
            'key'    => env('AWS_S3_KEY', 'your-key'),
            'secret' => env('AWS_S3_SECRET', 'your-secret'),
            'region' => env('AWS_S3_REGION', 'your-region'),
            'bucket' => env('AWS_S3_BUCKET', 'your-bucket'),
        ],
        'file-manager' => [
            'driver' => 's3',
            'key'    => env('AWS_S3_KEY', 'your-key'),
            'secret' => env('AWS_S3_SECRET', 'your-secret'),
            'region' => env('AWS_S3_REGION', 'your-region'),
            'bucket' => env('AWS_S3_BUCKET', 'your-bucket'),
        ],
    ],
];

I have the necessary AWS_S3_* values stored in .env.

config/elfinder.php

For the elfinder config I have gone with the suggestion of leaving roots null and setting up the disks array instead.

return array(
    'disks' => [
        's3' => [
            'alias'     => 'S3 Storage',
            'glideURL'  => '/glide_images',
            // 'glideKey' -- REDACTED
        ],
    ],
    'roots' => null,
);

... I also have a properly working Glide installation as evidenced by being able to access images from Flysystem using the /glide_images URL.

The only thing that's not working is the elfinder/Glide integration. As per the README file in laravel-elfinder:

You should now see a root 'public' in elFinder with the files in your public folder, with thumbnails generated by Glide. URLs will also point to the Glide server, for images.

So everything is working except that I don't see any thumbnails generated by Glide, and I can't see any access to the Glide URL (as I watch the server logs) while I'm operating elfinder. elfinder access to the files in Flysystem are working and I can use the Laravel Storage facade to access/modify/delete these files without problems. Also within my Glide ImageController I have been able to inject the Laravel Filesystem contract to create the Glide ServerFactory which is working well.

Questions:

  1. Is the config with the glideUrl parameter supplied under disks supposed to work? Should I be providing the config for the Flysystem storage under roots instead?

  2. Can I somehow rely on just the flysystem configuration in config/filesystems.php to give me all of the necessary flysystem config for elfinder or do I have to duplicate that into config/elfinder.php to pass all of the necessary options for (e.g.) Glide integration?

  3. Assuming that I do have to duplicate the flysystem config into config/elfinder.php, what does a working config for S3 Flysystem access under roots look like?

Thanks,

Del

@delatbabel
Copy link
Contributor Author

As a point of reference, this does not work:

    'roots' => [
        [
            'driver' => 'Flysystem',
            'glideURL'  => '/glide_images',
            // 'glideKey' REDACTED
            'alias' => 'S3 Flysystem',
            'filesystem' => new Filesystem(new AwsS3Adapter(
                new S3Client([
                    'credentials'   => [
                        'key'       => env('AWS_S3_KEY', 'your-key'),
                        'secret'    => env('AWS_S3_SECRET', 'your-secret'),
                    ],
                    'region'        => env('AWS_S3_REGION', 'your-region'),
                ]),
                env('AWS_S3_BUCKET', 'your-bucket')
            )),
        ],
    ],

... it throws errors in Illuminate\Container\Container->make('log', ...) no doubt because the log object in the application container hasn't yet been initialised.

As an alternative, trying this throws the same error:

    'roots' => [
        [
            'driver' => 'Flysystem',
            'glideURL'  => '/glide_images',
            // 'glideKey' REDACTED
            'alias' => 'S3 Flysystem',
            'filesystem' => app('filesystem')->disk(),
        ],
    ],

@delatbabel
Copy link
Contributor Author

OK I found a couple of things:

  • Glide integration does not work on the current released version. I switched to using dev-master and using my original config (setting disks but leaving roots null) the preview images are now working using Glide. I can see some changes that were made in Driver.php since the release version and now -- can these please be tagged? The MIME type wasn't being set by the S3 driver and so _stat() wasn't calling getUrl()

  • Despite that Glide integration is now working, I still can't see image icons when I view a folder in elfinder, I'm just presented with the default "panda" image icon. I can see that $stat["tmb"] is being set correctly, but not being used.

Has anyone gotten image icons to work?

@barryvdh
Copy link
Owner

So thumbnails work? Or which icons do you mean?

@delatbabel
Copy link
Contributor Author

To make it clear, these are the thumbnails that I see for all images:

https://salsa.babel.com.au/owncloud/index.php/s/7YCnZXhHrkuIiOz

When I open an info box for an image I see this:

https://salsa.babel.com.au/owncloud/index.php/s/nMCvj0A8rjp1lJt

The Link in that info box is the correct link to the file including the Glide URL. This is the information that I have that Glide integration is working (I also added a bunch of Log::debug statements in the Driver.php code to ensure that the _stat() function is doing the right thing, which it is).

@pcable
Copy link

pcable commented Nov 16, 2017

I've encountered the same issue. I think it's a problem in ElFinder and I've submitted a pull request for it. Studio-42/elFinder#2283

As @delatbabel said, the glide thumbnails urls are correct. They're just not being loaded.

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

3 participants