nlybe / cropper
Cropper jQuery image cropping tool for Elgg
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 3
Type:elgg-plugin
Requires
- php: >=5.6
- composer/installers: >=1.0.8
This package is auto-updated.
Last update: 2023-04-17 09:54:14 UTC
README
Responsive image cropping tool for Elgg, based on jQuery and integrating the JS library Cropper.
Cropper plugin replace the default core Elgg profile avatar cropping tool.
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
1. Replace core Elgg profile avatar cropping tool
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.
2. Use cropper input in any form
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):
// 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);