PHP code example of yaro / cropp
1. Go to this page and download the library: Download yaro/cropp 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/ */
yaro / cropp example snippets
// Laravel 5: config/app.php
'providers' => [
//...
Yaro\Cropp\ServiceProvider::class,
//...
];
<img src="{{ cropp('image.jpg')->invert()->fit(320, 200) }}" />
// <img src="http://example.com/storage/cropp/61bb83eae21cb5559fe0c583f14b0374.jpg">
<img src="{{ cropp('image.jpg', false)->greyscale()->rotate(-45)->resize(500, null) }}" />
// <img src="/storage/cropp/44aead54d338966bca06535d34edc3ae.jpg">
$thumbPath = cropp('image.jpg')->invert()->fit(320, 200)->src();
use Yaro\Cropp\Cropp;
$cropp = new Cropp('image.jpg', false);
$src = $cropp->fit(320, 200)->src();
echo $src; // /storage/cropp/44aead54d338966bca06535d34edc3ae.jpg
// or
$src = Cropp::make('image.jpg')->fit(320, 200)->src();
echo $src; // http://example.com/storage/cropp/61bb83eae21cb5559fe0c583f14b0374.jpg
bash
php artisan vendor:publish --provider="Yaro\Cropp\ServiceProvider"
bash
php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"