Hi and thanks for a very useful and easy to use module!

I've amended my copy slightly but would like to recommend that javascript and css are conditionally loaded in hook_init() rather than on every page (where it wont be needed):

function avatarcrop_init() {
/// MofakhamR: We don't want files loaded unneccesary (so I'm setting a conditional)
if((arg(1) == 'cropimage') || (arg(1) == 'getimage'))
{
$dimension=variable_get('user_picture_dimensions','100x100');
$widthXheight=split('x',$dimension);
$width = $widthXheight[0];
$height = $widthXheight[1];

drupal_add_js('var cwidth = '. $width .';','inline');
drupal_add_js('var cheight = '.$height.';','inline');

// amended file locations for sharing with avatarcrop module
drupal_add_js(drupal_get_path('module','avatarcrop').'/avatarcrop.js');
drupal_add_js(drupal_get_path('module','avatarcrop').'/js/jquery.Jcrop.js');
drupal_add_css(drupal_get_path('module','avatarcrop').'/css/jquery.Jcrop.css');
#drupal_add_css(drupal_get_path('module','avatarcrop').'/avatarcrop.css'); // doesnt exist in module??
}
}

Of course... I'm probably missing the css for user pages but I don't personally need them... but that brings me onto another issue: "avatarcrop.css" doesn't exist in the module but is attempted to be added??

Comments

adeel.iqbal’s picture

Assigned: Unassigned » adeel.iqbal

Thanks for the useful suggestion it will be incorporated soon. :P

adeel.iqbal’s picture

Status: Active » Closed (fixed)

fixed.