Giter VIP home page Giter VIP logo

fileupload's Introduction

File upload

Widget for easily control for file upload, store and format.

Latest Stable Version Total Downloads Build Status Scrutinizer Code Quality Code Coverage Software License

Configuration

Full-featured configuration example:

<?php
use \tkanstantsin\fileupload\FileManager;
use \tkanstantsin\fileupload\formatter\Image;
use \League\Flysystem\Adapter\Local as LocalFSAdapter;
use \League\Flysystem\Filesystem;

new FileManager([
    'uploadFS' => new Filesystem(new LocalFSAdapter(__DIR__ . '/tmp/upload', LOCK_EX, LocalFSAdapter::DISALLOW_LINKS)),
    'cacheFS' => new Filesystem(new LocalFSAdapter(__DIR__ . '/tmp/web', LOCK_EX, LocalFSAdapter::DISALLOW_LINKS)),

    'aliasArray' => [
        'attachment' => [
            'maxCount' => 1,
        ],
    ],
    'formatterConfigArray' => [
        'attachment-gallery' => [
            'class' => Image::class,
            'width' => 1920,
            'height' => 1080,
            'mode' => Image::RESIZE_INSET,
        ],
        'attachment-preview' => [
            'class' => Image::class,
            'width' => 300,
            'height' => 150,
            'mode' => Image::RESIZE_OUTBOUND,
        ],
    ],
]);

Alias

name - Alias name must contain only latin letters, digits, hyphen (-) and underscore

class

directory

maxSize

maxCount

multiple

hashMethod

cacheHashLength

filePathClosure

assetNameClosure

fileupload's People

Contributors

k-timoshenko avatar

fileupload's Issues

Check if target FS is writable before formatting

If target FS is not writable image formatters will load files in memory, resize (or any other operations) them, and then fails to write to target FS. It will overload server because of infinite image formatting.
Cache component must check if $asset path is writable before any formatters will called.

Add caching for unformattable files

Add empty file for unformattable files (e.g. wrong images or 404 files).

  • Create empty file with desired name
  • Before caching check if file exists and if it is not 0 byte weight
  • Add option with overdue for such files

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.