2017 © Pedro Peláez
 

library laravel-resizer

Artisan command to resize and create high-resolution images for use with picturefill scrset.

image

jeremytubbs/laravel-resizer

Artisan command to resize and create high-resolution images for use with picturefill scrset.

  • Sunday, March 19, 2017
  • by jeremytubbs
  • Repository
  • 1 Watchers
  • 1 Stars
  • 29 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Laravel Resizer

Artisan command to resize and create high-resolution images for use with picturefill / scrset. This package utilizes my image resizer package: https://github.com/jeremytubbs/resizer, (*1)

Setup

Add service provider to app/config:, (*2)

Jeremytubbs\LaravelResizer\ResizerServiceProvider::class,
````

Publish the `resizer.php` config file and the `picturefill.min.js` file:
```sh
php artisan vendor:publish

Usage

Artisan command to queue image resizing:, (*3)

php artisan resize:image

The artisan command accepts an image argument and an optional rename, source_path and destinataion argument. If no image argument is provided you will recieve a prompt to enter an image name. The --source_path and --destiination arguments default to the public/images directory. The --destination path appends to the image_path set in your config\resizer.php to create a directory structure for your resized images., (*4)

php artisan resize:image KISS.jpg --rename=keep-it-simple --source_path=resources/assets --destinataion=posts/kiss

The artisan command is queued and will use the default queue driver set in the queue.php config file., (*5)

If you would like to use the ResizeImage command inside a controller add the trait and dispatch the command:, (*6)

use Jeremytubbs\LaravelResizer\Commands\ResizeImage;

class MyController extends Controller
{
    use \Illuminate\Foundation\Bus\DispatchesJobs;

    public function resizeImage($image_path, $destination_path = null, $rename = null) {
        $command = new ResizeImage($image_path, $destination_path, $rename);
        $this->dispatch($command);
    }
}

The package makes two custom blade directives available:, (*7)

<head>
    @picturefill
</head>
<body>
    @srcset('/images/path/source.jpg')
</body>

will result in:, (*8)

<head>
    <script>
        // Picture element HTML5 shiv
        document.createElement( "picture" );
    </script>
    <script src="/vendor/laravel-resizer/picturefill.min.js" async></script>
</head>
<body>
    <img srcset="/images/path/source.jpg 1x, images/path/source@2x.jpg 2x">
</body>

The Versions

19/03 2017

dev-master

9999999-dev

Artisan command to resize and create high-resolution images for use with picturefill scrset.

  Sources   Download

MIT

The Requires

 

laravel thumbnails gd imagick laravel5 imagemagick retina picturefill 2x

03/03 2016

0.1.3

0.1.3.0

Artisan command to resize and create high-resolution images for use with picturefill scrset.

  Sources   Download

MIT

The Requires

 

laravel thumbnails gd imagick laravel5 imagemagick retina picturefill 2x

11/02 2016

0.1.2

0.1.2.0

Artisan command to resize and create high-resolution images for use with picturefill scrset.

  Sources   Download

MIT

The Requires

 

laravel thumbnails gd imagick laravel5 imagemagick retina picturefill 2x

10/02 2016

0.1.1

0.1.1.0

Artisan command to resize and create high-resolution images for use with picturefill scrset.

  Sources   Download

MIT

The Requires

 

laravel thumbnails gd imagick laravel5 imagemagick retina picturefill 2x

05/02 2016

0.1.0

0.1.0.0

Artisan command to resize and create high-resolution images for use with picturefill scrset.

  Sources   Download

MIT

The Requires

 

laravel thumbnails gd imagick laravel5 imagemagick retina picturefill 2x