Download the PHP package regulus/upstream without Composer

On this page you can find all versions of the php package regulus/upstream. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package upstream

Upstream

A simple composer package for Laravel 5 that assists in file uploads and image resizing/cropping.

Installation

To install Upstream, make sure regulus/upstream has been added to Laravel 5's composer.json file.

"require": {
    "regulus/upstream": "0.6.*"
},

Then run php composer.phar update from the command line. Composer will install the Upstream package. Now, all you have to do is register the service provider and set up Upstream's alias in config/app.php. Add this to the providers array:

Regulus\Upstream\UpstreamServiceProvider::class,

And add this to the aliases array:

'Upstream' => Regulus\Upstream\Facade::class,

Finally, run php artisan vendor:publish to publish the config file and language file.

Uploading Files

$config = [
    'path'            => 'uploads/pdfs', // the path to upload to
    'field'           => 'file',         // name of field (use "fields" for an array with multiple fields)
    'filename'        => 'temp',         // the basename of the file (extension will be added automatically)
    'fileTypes'       => ['png', 'jpg'], // the file types to allow
    'createDirectory' => true,           // automatically creates directory if it doesn't exist
    'overwrite'       => true,           // whether or not to overwrite existing file of the same name
    'maxFileSize'     => '5MB',          // the maximum filesize of file to be uploaded
];

$upstream = Upstream::make($config);
$result   = $upstream->upload();

Note: Special filename strings are available including [LOWERCASE], [UNDERSCORED], [LOWERCASE-UNDERSCORED], [DASHED], [LOWERCASE-DASHED], and [RANDOM]. The former five are used to make formatting adjustments to the original filename. The latter can be used to set the filename to a random string (along with its original extension).

Resizing Images and Creating Thumbnails

$config = [
    'path'               => 'uploads/images',
    'fields'             => ['picture', 'picture2'],
    'filename'           => 'temp',
    'fileTypes'          => 'images',
    'createDirectory'    => true,
    'overwrite'          => true,
    'maxFileSize'        => '5MB',
    'imageResize'        => true,
    'imageResizeQuality' => 60,
    'imageCrop'          => true,
    'imageDimensions'    => [
        'w'  => 720, // image width
        'h'  => 360, // image height
        'tw' => 180, // thumbnail image width
        'th' => 180, // thumbnail image height
    ],
];

$upstream = Upstream::make($config);
$result   = $upstream->upload();

An entire set of configuration array is available in the config file at src/config/config.php. You may crop images after they have been uploaded with the following:

$config = [
    'path'            => 'uploads/images',
    'filename'        => 'temp-'.$id.'.jpg',
    'newFilename'     => $id.'.jpg',
    'createDirectory' => true,
    'overwrite'       => true,
    'imageThumb'      => true,
    'imageDimensions' => [
        'w'  => 260, // image width
        'h'  => 260, // image height
        'tw' => 120, // thumbnail image width
        'th' => 120, // thumbnail image height
    ],
    'cropPosition' => [
        'x' => $input['x'],      // X position
        'y' => $input['y'],      // Y position
        'w' => $input['width'],  // width of cropped area
        'h' => $input['height'], // height of cropped area
    ],
];

$result = Upstream::cropImage($config);

You may use a JavaScript image cropper such as Cropper to set the cropPosition. If you leave cropPosition null or unset, the image will first be scaled to 140% of the target dimensions and then cropped from the center.


All versions of upstream with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
laravel/framework Version 5.*
intervention/image Version 2.4.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package regulus/upstream contains the following files

Loading the files please wait ....