PHP code example of square1 / resized-laravel

1. Go to this page and download the library: Download square1/resized-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

square1 / resized-laravel example snippets


    'providers' => array(
        // ...
        Square1\Laravel\Resized\ResizedServiceProvider::class,
    )

    'aliases' => array(
        // ...
        'Resized' => Square1\Laravel\Resized\ResizedFacade::class,
    )

'options' => [
    'quality' => 90,
],

Resized::setDefaultImage('http://www.example.com/no-image.jpg');

$url = Resized::process('http://www.example.com/some-image-to-resize.jpg', '300', '500');

$url = Resized::process('http://www.example.com/some-image-to-resize.jpg', '300');

$url = Resized::process('http://www.example.com/some-image-to-resize.jpg', '', '500');

$url = Resized::process('http://www.example.com/some-image-to-resize.jpg', '300', '500', 'A nice image name');

$url = Resized::process('http://www.example.com/some-image-to-resize.jpg', '', '500', 'A nice image name', ['quality' => 100]);

Resized::setMaxSlugLength(50);
$url = Resized::process('http://www.example.com/some-very-long-image-filename.jpg', '300', '500');

$url = Resized::process('/uploads/image.jpg', '300', '500');
// Returns '/uploads/image.jpg' unmodified