Giter Club home page Giter Club logo

filemanager's Introduction

About

The file manager intended for using Laravel with CKEditor / TinyMCE. File manager in table database, do not browse on the server folder. File Manager demo

Features

  • DB media and media folder
  • Chunk upload support
  • CKEditor and TinyMCE integration
  • Uploading validation
  • Cropping and resizing of images
  • Add custom support type
  • Image optimize after upload
  • Multi media select

Install

  • Install package
composer require tadcms/filemanager
  • Publish the package’s config and assets:
php artisan vendor:publish --provider="Tadcms\FileManager\Providers\FileManagerServiceProvider" --tag=config
php artisan vendor:publish --provider="Tadcms\FileManager\Providers\FileManagerServiceProvider" --tag=assets
  • Migration
php artisan migrate
  • Create symbolic link:
php artisan storage:link
  • Edit routes/web.php
Route::group(['prefix' => 'file-manager', 'middleware' => ['web', 'auth']], function (){
    \Tadcms\FileManager\Routes::web();
});

Usage

Add media with \Illuminate\Http\UploadedFile

use Tadcms\FileManager\Facades\FileManager;

FileManager::withResource(request()->file('upload_file'))
    ->setFolder($folder_id)
    ->setType($type)
    ->save();

Add media with url

use Tadcms\FileManager\Facades\FileManager;

FileManager::withResource($urlFile)
    ->setFolder($folder_id)
    ->setType($type)
    ->save();

Add media with path

use Tadcms\FileManager\Facades\FileManager;

FileManager::withResource($pathFile)
    ->setFolder($folder_id)
    ->setType($type)
    ->save();

Params:

$folder_id: Id lfm_folder_media table
$type: image/file or customs your type

Configs

<?php

return [
    /**
     * Prefix route your file manager
     * Default: file-manager
     * */
    'route_prefix' => env('LFM_PREFIX', 'file-manager'),
    /**
     * File system disk for upload by file-manager
     * Default: public
     * */
    'upload_disk' => env('UPLOAD_DISK', 'public'),

    /**
     * File system disk for temps file
     * Default: local
     * */
    'temp_disk' => env('TEMP_DISK', 'local'),

    /**
     * Optimizer image after upload by file manager
     * You can install the necessary binaries to use
     * Read more: https://github.com/spatie/image-optimizer/blob/master/README.md
     *
     * Default: false
     * */
    'image-optimizer' => false,

    /**
     * File type for file manager: type=filetype
     * You can add new file type
     * Default: image, file
     * */
    'file_types' => [
        'image' => [
            /**
             * Max file size upload for type=image (MB)
             * Default: 15 MB
             * */
            'max_file_size' => 15, //MB
            /**
             * Mime Types file allowed upload for type=image
             * Default: 15 MB
             * */
            'mimetypes' => [
                'image/jpeg',
                'image/pjpeg',
                'image/png',
                // ...
            ]
        ],
        'file' => [
            'max_file_size' => 1024, //MB
            'mimetypes' => [
                'image/jpeg',
                'application/pdf',
                // ...
            ]
        ],
    ]
];

Credits

Laravel File Manager

License

The Laravel File Manager package is open-sourced software licensed under the MIT license.

filemanager's People

Contributors

juzaweb avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

marcelofajardo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.