PHP code example of nlybe / cropper

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

    

nlybe / cropper example snippets


// assign photo to cropper input
$master_img = elgg_view('output/img', array(
    'src' => $vars['entity']->getIconUrl('master'),
    'alt' => elgg_echo('avatar'),
    'class' => 'mrl',
    'id' => 'image',
));
$vars['image_to_crop'] = $master_img;

// optionally assign custom aspectratio to overide the aspectratio in settings
// set blank for free ratio or enter number e.g. 1 for 1/1
// if put comment the following line, the aspectratio value from settings will be used
$vars['aspectratio'] = 1;

echo elgg_view_input('cropper', $vars);