Elgg Cropper
, (*1)
Responsive image cropping tool for Elgg, based on jQuery and integrating the JS library Cropper., (*2)
Cropper plugin replace the default core Elgg profile avatar cropping tool., (*3)
Features
- Supports touch (mobile)
- Supports to crop on a canvas
- Responsive
- Option to add cropper as a form input
- Option to select size of preview box in settings
- Plenty of Cropper tool options available on plugin settings
- Aspectratio cropper option can be passed as param in cropper input, overriding the value plugin settings
How to Use
If plugin is enabled, the default core Elgg profile avatar cropping tool is replaced by this image cropping tool. Several options in plugin settings can be used for customizing the tool., (*4)
The cropper input can be used in any Elgg form, passing just the image to crop and optionally the Aspectratio (overriding the value plugin settings):, (*5)
// 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);