2017 © Pedro Peláez
 

library resize-and-watermark

Resize and Watermark for Laravel resizes and watermarks your pictures easily

image

montesjmm/resize-and-watermark

Resize and Watermark for Laravel resizes and watermarks your pictures easily

  • Wednesday, March 16, 2016
  • by montesjmm
  • Repository
  • 1 Watchers
  • 1 Stars
  • 91 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 1 % Grown

The README.md

Build Status, (*1)

Resize And Watermark (images)

Easily automate picture upload, generating of multiple sizes and watermarking if needed., (*2)

Laravel 5.2 Installation

  1. Add to your composer require: "montesjmm/resize-and-watermark": "~0.3"
  2. Add service provider to your config/app.php: Montesjmm\ResizeAndWatermark\ResizeAndWatermarkServiceProvider::class,
  3. Add alias to your config/app.php aliases: 'ResizeAndWatermark' => Montesjmm\ResizeAndWatermark\ResizeAndWatermark::class,
  4. composer update
  5. php artisan vendor:publish
  6. php artisan migrate
  7. composer dump-autoload -o
  8. php artisan db:seed --class=RwPicturesSizesTableSeeder

Examples

Download and generate sizes from image url

$resizer = new ResizeAndWatermark;
$picture = $resizer->store('http://example.com/image.jpg');

echo $picture->html('small'); // <img src="http://mysite.com/uploads/2015/03/20150327-picture_small.jpg">

echo $picture->html('big'); // <img src="http://laravel5.app/uploads/2015/03/20150327-picture_big.jpg">

Generate sizes of form uploaded image

$resizer = new ResizeAndWatermark;
$file = Input::file()['file'];
$picture = $resizer->store($file);

echo $picture->html('small'); // <img src="http://mysite.com/uploads/2015/03/20150327-picture_small.jpg">

Example App

app/Http/routes.php

Route::get('/', 'WelcomeController@index');
Route::post('/', 'WelcomeController@index');

app/Http/controllers/WelcomeController.php

<?php namespace App\Http\Controllers;

use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Input;
use Montesjmm\ResizeAndWatermark\ResizeAndWatermark;

class WelcomeController extends Controller {

    public function index()
    {
        if (Request::isMethod('post')) {
            $resizer = new ResizeAndWatermark;

            $file = Input::file()['file'];

            $picture = $resizer->store($file);

            return '<img src="' . $picture->url('small') . '">';
        }

        return view('welcome');
    }
}

resources/views/welcome.blade.php

<html>
    <head>
        <title>Resize And Watermark Test</title>
    </head>
    <body>
        <form method="post" enctype="multipart/form-data">
            <input type="hidden" name="_token" value="{{{ csrf_token() }}}">
            <input type="file" name="file">
            <input type="submit" value="send">
        </form>
    </body>
</html>

When you upload a picture this will be the result in disk:, (*3)

private-uploads/2015/03/20150326-picture_orig.jpg
public/uploads/2015/03/20150326-picture_bigger.jpg
public/uploads/2015/03/20150326-picture_big.jpg
public/uploads/2015/03/20150326-picture_medbig.jpg
public/uploads/2015/03/20150326-picture_medium.jpg
public/uploads/2015/03/20150326-picture_small.jpg
public/uploads/2015/03/20150326-picture_thumb.jpg
public/uploads/2015/03/20150326-picture_tiny.jpg

"laravel/private-uploads" and "laravel/public/uploads" must be writable., (*4)

Config

at config/resize-and-watermark.php you can setup the routes for the watermarking files if you want watermarking., (*5)

The Versions

16/03 2016

dev-master

9999999-dev https://github.com/montes/resize-and-watermark

Resize and Watermark for Laravel resizes and watermarks your pictures easily

  Sources   Download

MIT

The Requires

 

The Development Requires

resize thumbnail watermark picture resize picture thumbnail

16/03 2016

0.3.1

0.3.1.0 https://github.com/montes/resize-and-watermark

Resize and Watermark for Laravel resizes and watermarks your pictures easily

  Sources   Download

MIT

The Requires

 

The Development Requires

resize thumbnail watermark picture resize picture thumbnail

19/02 2016

0.3

0.3.0.0 https://github.com/montes/resize-and-watermark

Resize and Watermark for Laravel resizes and watermarks your pictures easily

  Sources   Download

MIT

The Requires

 

The Development Requires

resize thumbnail watermark picture resize picture thumbnail

10/03 2015

0.2.1

0.2.1.0 https://github.com/montes/resize-and-watermark

Resize and Watermark for Laravel resizes and watermarks your pictures easily

  Sources   Download

MIT

The Requires

 

The Development Requires

resize thumbnail watermark picture resize picture thumbnail

22/08 2014

0.1.2

0.1.2.0 https://github.com/montes/resize-and-watermark

Resize and Watermark for Laravel resizes and watermarks your pictures easily

  Sources   Download

MIT

The Requires

 

resize thumbnail watermark picture resize picture thumbnail

22/08 2014

0.1.1

0.1.1.0 https://github.com/montes/resize-and-watermark

Resize and Watermark for Laravel resizes and watermarks your pictures easily

  Sources   Download

MIT

The Requires

 

resize thumbnail watermark picture resize picture thumbnail

19/08 2014

0.1.0

0.1.0.0 https://github.com/montes/resize-and-watermark

  Sources   Download

MIT

The Requires

 

resize thumbnail watermark picture resize picture thumbnail