1. Go to this page and download the library: Download rainetro/laravel-imagebox 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/ */
use Illuminate\Database\Eloquent\Model;
use Rainet\ImageBox\ImageBoxInterface;
use Rainet\ImageBox\ImageBoxTrait;
class Post extends Model implements ImageBoxInterface
{
use ImageBoxTrait;
// ...
public function registerImageCollections(): void
{
$this
->addImageCollection('image')
->acceptsMimeTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp']);
}
public function registerImageCollectionConversions(): void
{
$this
->getImageCollection('image')
->addConversion('thumb')
->width(480)
->quality(90);
// $this
// ->getImageCollection('image')
// ->addConversion('medium')
// ->width(600)
// ->height(600)
// ->quality(90);
}
}