dosarkz / laravel-uploader by dosarkz

Uploading Class for laravel 5
269
2
2
Package Data
Maintainer Username: dosarkz
Maintainer Contact: ashenov.e@gmail.com (Yezhan Ashenov)
Package Create Date: 2017-04-17
Package Last Update: 2017-12-22
Home Page:
Language: PHP
License: Unknown
Last Refreshed: 2025-02-08 15:02:22
Package Statistics
Total Downloads: 269
Monthly Downloads: 3
Daily Downloads: 1
Total Stars: 2
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

laravel-uploader

Laravel 5 image and file uploader with resizer http://image.intervention.io/

Install

composer require dosarkz/laravel-uploader

Add to config/app.php

Provider

Dosarkz\LaravelUploader\Provider\LaravelUploaderServiceProvider::class

Alias

'Uploader' => Dosarkz\LaravelUploader\Facade\LaravelUploaderFacade::class
  

Sample image upload

Uploader::image(uploaded_file, destination, resize, imageWidth, imageHeight, thumbWidth, thumbHeight)
  • @uploaded_file - instance of UploadedFile
  • @destination - the path to the image, 'images/articles', string
  • @resize - A parameter that determines to use compression or not. In the case of using need to fill one of the parameters the resolution of the image, true or false, boolean
  • @imageWidth, @imageHeight - the parameters of the image in pixels, 100, numeric
  • @thumbWidth, @thumbHeight - the parameters of the thumbnail in pixels, 100, numeric
  use Uploader;
  
  $image_uploader  = Uploader::image($request->file('avatar'));
  $image = Image::create([
      'name' => $image_uploader->getFileName(),
      'thumb' => $image_uploader->getThumb(),
      'path' => $image_uploader->getDestination(),
  ]);

Sample file upload

Uploader::file(uploaded_file, destination)
  • @uploaded_file - instance of UploadedFile
  • @destination - the path to the image, 'images/articles', string
use Uploader;
  
 $image_uploader  = Uploader::file($request->file('file'));

  $file = File::create([
      'name' => $image_uploader->getFileName(),
      'path' => $image_uploader->getDestination(),
      'user_id' => auth()->user()->id
  ]);