Elgg  Version 2.3
crop.php
Go to the documentation of this file.
1 <?php
7 $guid = get_input('guid');
9 
10 if (!$owner || !($owner instanceof ElggUser) || !$owner->canEdit()) {
11  register_error(elgg_echo('avatar:crop:fail'));
13 }
14 
16  'x1' => (int) get_input('x1', 0),
17  'y1' => (int) get_input('y1', 0),
18  'x2' => (int) get_input('x2', 0),
19  'y2' => (int) get_input('y2', 0),
20 ];
21 
22 // ensuring the avatar image exists in the first place
23 if (!$owner->hasIcon('master')) {
24  register_error(elgg_echo('avatar:crop:fail'));
26 }
27 
28 if (!$owner->saveIconFromElggFile($owner->getIcon('master'), 'icon', $coords)) {
29  register_error(elgg_echo('avatar:crop:fail'));
31 }
32 
33 system_message(elgg_echo('avatar:crop:success'));
34 $view = 'river/user/default/profileiconupdate';
35 _elgg_delete_river(array('subject_guid' => $owner->guid, 'view' => $view));
37  'view' => $view,
38  'action_type' => 'update',
39  'subject_guid' => $owner->guid,
40  'object_guid' => $owner->guid,
41 ));
42 
43 
$view
Definition: crop.php:34
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
_elgg_delete_river(array $options=[])
Alias of elgg_delete_river() that doesn&#39;t raise notices.
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:425
elgg_create_river_item(array $options=array())
Adds an item to the river.
Definition: river.php:39
$owner
Definition: crop.php:8
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
$guid
Avatar crop action.
Definition: crop.php:7
const REFERER
Definition: elgglib.php:2123
elgg system_message
Wrapper function for system_messages.
Definition: elgglib.js:390
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:399
if(!$owner||!($owner instanceof ElggUser)||!$owner->canEdit()) $coords
Definition: crop.php:15
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:204