PHP code example of wcactus / croppedimages

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

    

wcactus / croppedimages example snippets


return [
	'disk' => 'public',
	'folder' => 'images',
	'crops' => [
		'App\Brand' => [
			'main_page_logo' => [
				'label' => 'logotype for main page',
				'method' => 'fit',
				'w' => 135,
				'h' => 80,
				'bg' => '#000000',
			],
			'small' => [
				'label' => 'small image',
				'method' => 'fit',
				'w' => 140,
				'h' => 140,
				'bg' => '#ffffff',
			],
		],
		'App\Product' => [
			'small' => [
				'label' => 'small image',
				'method' => 'crop',
				'w' => 140,
				'h' => 140,
				'bg' => '#ffffff',
			],
		],
	],
];

CroppedImages::routes();

<img src="{{ CroppedImages::src($image, 'small') }}" alt="{{ $image->alt }}"/>

use \Wcactus\CroppedImages\WithCroppedImages;