/**
 * Build image of the user and save it to the given path
 * @param User $user  user
 * @param string      $path         image file path including format (eg: users/toto.png)
 * @access public
 * @return void
 */
function generate_userImage($user, $path)
{
    if (!can_write($path)) {
        throw new Exception(_f('Can\'t write to file %s', array($path)));
    }
    $image = $user->generate_image();
    $image->save($path);
    return $image;
}