PHP code example of inweb / media

1. Go to this page and download the library: Download inweb/media 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/ */

    

inweb / media example snippets


    php artisan migrate
    

use InWeb\Media\Thumbnail;

...

public function getImageThumbnails()
{
    return [
        'catalog' => new Thumbnail(function (\Intervention\Image\Image $image) {
            return $image->resize(100, 100, function (Constraint $c) {
                $c->aspectRatio();
                $c->upsize();
            })->resizeCanvas(100, 100);
        }, true),
    ];
}

public function getImageThumbnails()
{
    return [
        'original' => new Thumbnail(...),
    ];
}