PHP code example of lee-to / pixel-craft

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

    

lee-to / pixel-craft example snippets




namespace App\Models;

use Leeto\PixelCraft\Traits\HasGeneratedImage;
use Illuminate\Database\Eloquent\Model;

class Article extends Model
{
    use HasGeneratedImage;

    // ..

    protected function imageDir(): string
    {
        return 'articles';
    }

    protected function imageColumn(): string
    {
        return 'thumbnail';
    }

    // ..
}

$model->makeImage('200x200')

$model->makeImages('200x200')

$model->makeImage('200x200', 'fit')
shell
php artisan vendor:publish --provider="Leeto\PixelCraft\PixelCraftServiceProvider"