The Cropper jQuery image cropping tool for Elgg
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
languages
lib
views/default
CHANGELOG.md
README.md
activate.php
autoloader.php
composer.json
manifest.xml
start.php
views.php

README.md

Elgg Cropper

Elgg 2.1+

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);