- function show_avatar_form()
- {
-
- $user = common_current_user();
- $profile = $user->getProfile();
-
- if (!$profile) {
- common_log_db_error($user, 'SELECT', __FILE__);
- $this->server_error(_('User without matching profile'));
- return;
- }
-
- $original = $profile->getOriginalAvatar();
-
-
- common_element_start('form', array('enctype' => 'multipart/form-data',
- 'method' => 'POST',
- 'id' => 'avatar',
- 'action' =>
- common_local_url('profilesettings')));
- common_hidden('token', common_session_token());
-
- if ($original) {
- common_element_start('div', array('id'=>'avatar_original', 'class'=>'avatar_view'));
- common_element('h3', null, _("Original:"));
- common_element_start('div', array('id'=>'avatar_original_view'));
- common_element('img', array('src' => $original->url,
- 'class' => 'avatar original',
- 'width' => $original->width,
- 'height' => $original->height,
- 'alt' => $user->nickname));
- common_element_end('div');
- common_element_end('div');
- }
-
- $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-
- if ($avatar) {
- common_element_start('div', array('id'=>'avatar_preview', 'class'=>'avatar_view'));
- common_element('h3', null, _("Preview:"));
- common_element_start('div', array('id'=>'avatar_preview_view'));
- common_element('img', array('src' => $original->url,//$avatar->url,
- 'class' => 'avatar profile',
- 'width' => AVATAR_PROFILE_SIZE,
- 'height' => AVATAR_PROFILE_SIZE,
- 'alt' => $user->nickname));
- common_element_end('div');
- common_element_end('div');
-
- foreach(array('avatar_crop_x', 'avatar_crop_y', 'avatar_crop_w', 'avatar_crop_h') as $crop_info) {
- common_element('input', array('name' => $crop_info,
- 'type' => 'hidden',
- 'id' => $crop_info));
- }
- common_submit('crop', _('Crop'));
- }
-
- common_element('input', array('name' => 'MAX_FILE_SIZE',
- 'type' => 'hidden',
- 'id' => 'MAX_FILE_SIZE',
- 'value' => MAX_AVATAR_SIZE));
-
- common_element_start('p');