2017 © Pedro Peláez
 

library manager

Provides an easier way to upload images with configurations

image

anekdotes/manager

Provides an easier way to upload images with configurations

  • Thursday, April 6, 2017
  • by anekdotes
  • Repository
  • 2 Watchers
  • 0 Stars
  • 288 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 1 % Grown

The README.md

Anekdotes Manager

Latest Stable Version Total Downloads License PHP Version Require, (*1)

A library that provides an easy way to upload files to the server simply by using configurations., (*2)

Installation

Install via composer into your project:, (*3)

composer require anekdotes/manager

Usage

Use the class where ever you need it:, (*4)

use Anekdotes\Manager\Manager;

See configuration section below for more information, (*5)

With Laravel:, (*6)

$manager = new Manager(array);
$manager->manage(Input::file('nameOfInput'));

Without Laravel:, (*7)

$manager = new Manager(array);
$manager->manage($_FILES['nameOfInput']);

Catch errors/exceptions:, (*8)

try {
    $manager = new Manager(array);
    $manager->manage($_FILES['nameOfInput']);
} catch (\Exception $e) {
    //do something
}

Configurations

Instantiation

You can pass a config array to the Manager's constructor., (*9)

    new Manager(array());

Available properties:, (*10)

prefix : type string. Path's prefix to upload file (default: /public), (*11)

    'prefix' => '/public',

path : type string. Path to upload file (default: /uploads), (*12)

    'path' => 'uploads/',

exts : type array. Array of all supported file extensions (default: jpg, jpeg, png), (*13)

    'exts' => array('jpeg', 'jpg', 'png),

weight : type integer. Maximum file size in bytes (default: 3 mbs), (*14)

    'weight' => 3000000,

size : type array. Array containing as many sizes as needed (default: null), (*15)

    'size' => array(
    ),

Put together:, (*16)

    $manager = new Manager(array(
        'prefix' => '/public',
        'path' => 'uploads/',
        'exts' => array('jpeg', 'jpg', 'png),
        'weight' => 3000000
    ));

Manage method's callback

You may pass a closure to the manage method to execute special code before uploading file such as creating an entry in the database or simply changing name., (*17)

    $manager->manage($_FILES['nameOfInput'], function($fi){
        //do something fancy
        return "potato.jpg";
    });

With the above example and default configurations, the new file will be located at /public/uploads as potato.jpg., (*18)

The Versions

06/04 2017

dev-master

9999999-dev

Provides an easier way to upload images with configurations

  Sources   Download

MIT

The Requires

 

The Development Requires

file upload image manager

06/04 2017

1.2.0

1.2.0.0

Provides an easier way to upload images with configurations

  Sources   Download

MIT

The Requires

 

The Development Requires

file upload image manager

27/07 2016

1.1.0

1.1.0.0

Provides an easier way to upload images with configurations

  Sources   Download

MIT

The Requires

 

The Development Requires

file upload image manager

04/04 2016

1.0.7

1.0.7.0 https://github.com/anekdotes/manager

Provides an easier way to upload images with configurations

  Sources   Download

MIT

The Requires

 

file upload image manager

04/04 2016

1.0.6

1.0.6.0 https://github.com/anekdotes/manager

Provides an easier way to upload images with configurations

  Sources   Download

MIT

The Requires

 

file upload image manager

23/03 2016

1.0.5

1.0.5.0 https://github.com/anekdotes/manager

Provides an easier way to upload images with configurations

  Sources   Download

MIT

The Requires

 

file upload image manager

23/03 2016

1.0.4

1.0.4.0 https://github.com/anekdotes/manager

Provides an easier way to upload images with configurations

  Sources   Download

MIT

The Requires

 

file upload image manager

21/03 2016

1.0.3

1.0.3.0 https://github.com/anekdotes/manager

Provides an easier way to upload images with configurations

  Sources   Download

MIT

The Requires

 

file upload image manager

18/03 2016

1.0.2

1.0.2.0 https://github.com/anekdotes/manager

Provides an easier way to upload images with configurations

  Sources   Download

MIT

The Requires

 

file upload image manager

18/03 2016

1.0.1

1.0.1.0 https://github.com/anekdotes/manager

Provides an easier way to upload images with configurations

  Sources   Download

MIT

The Requires

 

file upload image manager

17/03 2016

1.0.0

1.0.0.0 https://github.com/anekdotes/manager

Provides an easier way to upload images with configurations

  Sources   Download

MIT

The Requires

 

file upload image manager