PHP code example of alex-kudrya / lara-thumb
1. Go to this page and download the library: Download alex-kudrya/lara-thumb 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/ */
alex-kudrya / lara-thumb example snippets
use Illuminate\Http\Request;
use Kudrya\LaraThumb\LaraThumb
class MakeThumbnail()
{
public function run(Request $request, int $width = 100, int $height = 100)
{
$file = $request->file('image');
LaraThumb::processing($file, $width, $height, 'cover', false)
// That's all, your image was reduced!
// Then save the $file or do what you need with it...
}
};