hypejunction/cropper

Cropper for Elgg

Installs: 85

Dependents: 1

Suggesters: 1

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 0

Language:JavaScript

Type:elgg-plugin

1.1.0 2016-01-25 16:10 UTC

This package is auto-updated.

Last update: 2024-11-29 04:52:13 UTC


README

Elgg 1.11 Elgg 1.12 Elgg 2.0

Responsive image cropping input for Elgg

file input

Usage

Add cropper as a form input

echo elgg_view('input/cropper', array(
	'src' => 'http://example.com/uri/image.jpg',
	'ratio' => 16/9,
	'name' => 'crop_coords',
));

Add cropper to a file input (basic usage)

// in your form
echo elgg_view('input/file', array(
    'name' => 'avatar',
    'use_cropper' => true,
));

// in your action
$coords = get_input('crop_coords');

Add cropper to a file input (advanced usage)

// in your form
echo elgg_view('input/file', array(
	'name' => 'cover',
	'use_cropper' => array(
		'name' => 'cover_crop_coords',
		'ratio' => 16/9,
		'src' => '/uri/image.jpg', // previously uploaded file
		'x1' => 100,
		'y1' => 100,
		'x2' => 260,
		'y2' => 190,
	),
));

// in your action
$coords = get_input('cover_crop_coords');

Notes

  1. In your action, be sure to use the same image source for cropping. If you passed master image source to the file input, you will need to implement the logic for both new file upload and master image, as cropping coordinates may change even without new file upload.