diff options
Diffstat (limited to 'views/default/forms/avatar')
-rw-r--r-- | views/default/forms/avatar/crop.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/views/default/forms/avatar/crop.php b/views/default/forms/avatar/crop.php index 9fcae25c4..1f39ff73c 100644 --- a/views/default/forms/avatar/crop.php +++ b/views/default/forms/avatar/crop.php @@ -5,6 +5,9 @@ * @uses $vars['entity'] */ +elgg_load_js('jquery.imgareaselect'); +elgg_load_css('jquery.imgareaselect'); + $master_image = $vars['entity']->getIconUrl('master'); ?> @@ -25,8 +28,6 @@ echo elgg_view('input/submit', array('value' => elgg_echo('avatar:create'))); ?> </div> <!-- grab the required js for icon cropping --> -<script type="text/javascript" src="<?php echo elgg_get_site_url(); ?>vendors/jquery/jquery.imgareaselect-0.9.8/scripts/jquery.imgareaselect.min.js"></script> -<link rel="stylesheet" type="text/css" href="<?php echo elgg_get_site_url(); ?>vendors/jquery/jquery.imgareaselect-0.9.8/css/imgareaselect-deprecated.css" media="screen" /> <?php //@todo JS 1.8: no ?> <script type="text/javascript"> @@ -61,9 +62,12 @@ echo elgg_view('input/submit', array('value' => elgg_echo('avatar:create'))); $('<div id="user-avatar-preview"><img src="<?php echo $master_image; ?>" /></div>').insertAfter($('#user-avatar')); $('<div id="user-avatar-preview-title"><label><?php echo elgg_echo('avatar:preview'); ?></label></div>').insertBefore($('#user-avatar-preview')); - // this produces the coordinates - $('#user-avatar').imgAreaSelect({ selectionOpacity: 0, onSelectEnd: selectChange }); - // show the preview - $('#user-avatar').imgAreaSelect({ aspectRatio: '1:1', onSelectChange: preview }); + // init the cropping + $('#user-avatar').imgAreaSelect({ + selectionOpacity: 0, + aspectRatio: '1:1', + onSelectEnd: selectChange, + onSelectChange: preview + }); }); </script> |