PHPackages                             dandisy/filemanager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. dandisy/filemanager

ActiveLibrary[File &amp; Storage](/categories/file-storage)

dandisy/filemanager
===================

Webcore Filemanager

1.3.1(4y ago)01.4k2MITJavaScriptPHP ^7.3|^8.0CI failing

Since Jan 2Pushed 4y ago1 watchersCompare

[ Source](https://github.com/dandisy/filemanager)[ Packagist](https://packagist.org/packages/dandisy/filemanager)[ Docs](https://github.com/dandisy/filemanager)[ RSS](/packages/dandisy-filemanager/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (7)Dependencies (3)Versions (8)Used By (2)

FileManager for Webcore
=======================

[](#filemanager-for-webcore)

Custom file manager for Webcore

For

based on

[![screenshot-1](https://cloud.githubusercontent.com/assets/74367/15646143/77016990-265c-11e6-9ecc-d82ae2c74f71.png)](https://cloud.githubusercontent.com/assets/74367/15646143/77016990-265c-11e6-9ecc-d82ae2c74f71.png)

### Note

[](#note)

```
add meta csrf_token in html head section

Dependencies
Webcore settings system

add uploadCropped route
Route::post('uploadCropped', function(Request $request) {
    $folderPath = storage_path('app/public');

    $image_parts = explode(";base64,", $request->img);
    $image_type_aux = explode("image/", $image_parts[0]);
    $image_type = $image_type_aux[1];
    $image_base64 = base64_decode($image_parts[1]);
    $file = $folderPath . '/cropped-' . uniqid() . '.'.$image_type;

    file_put_contents($file, $image_base64);
});

```

### Image Manipulation

[](#image-manipulation)

- using league/glide-laravel

```
use Illuminate\Contracts\Filesystem\Filesystem;
use League\Glide\ServerFactory;
use League\Glide\Responses\LaravelResponseFactory;

...

Route::get('/imgGlide/{path}', function(Filesystem $filesystem, $path) {
    $server = ServerFactory::create([
        'response' => new LaravelResponseFactory(app('request')),
        'source' => $filesystem->getDriver(),
        'cache' => $filesystem->getDriver(),
        'cache_path_prefix' => '.cache',
        'base_url' => 'img',
    ]);

    if($filesystem->exists('public/'.$path)) {
        return $server->getImageResponse('public/'.$path, request()->all());
    }

    // return $server->getImageResponse('public/default.jpg', []);
    return abort(404);
})->where('path', '.*');

```

- using intervention/image

```
use Intervention\Image\ImageManagerStatic as Image;

...

Route::get('imgIntervention', function(Request $request) {
    // $url = $request->url;
    $url = str_replace(' ', '%20', $request->url);
    $tmp = str_replace(env('APP_URL'), '', $url);
    $tmpArray = explode('/', $tmp);
    $name = 'img-glide' . '-w' . $request->w . '-h' . $request->h . '-' . end($tmpArray);

    $headers = @get_headers($url, 1); // @ to suppress errors. Remove when debugging.
    if (isset($headers['Content-Type'])) {
        if (strpos($headers['Content-Type'], 'image/') === FALSE) {
            // Not a regular image (including a 404).
            return $url;
        }
        else {
            // It's an image!
            if(file_exists(public_path('img-cache/' . $name))) {
                //
            } else {
                $img = Image::make($url);
                $img->resize($request->w, $request->h, function ($constraint) {
                    $constraint->aspectRatio();
                })->save(public_path('img-cache/' . $name), 60);
            }
        }
    }
    else {
        // No 'Content-Type' returned.
        return $url;
    }

    return asset('img-cache/' . $name);
});

```

### Installation

[](#installation)

First require this package:

```
composer require dandisy/filemanager
composer require intervention/image
```

Add the provider on ‘app.php’:

```
Webcore\FileManager\FileManagerServiceProvider::class,
```

Aliase to `Zipper` is automatic loaded from `FileManagerServiceProvider (It's required to download folders in zip format):

Publish config, views and public files:

```
php artisan vendor:publish --provider="Webcore\FileManager\FileManagerServiceProvider"
```

Then you need to modify options on new file on options `filemanager.php`

```
