1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-16 23:00:51 +03:00

Фикс загрузки аватарки блога

This commit is contained in:
Mzhelskiy Maxim 2014-11-20 18:42:45 +07:00
parent b7d6afd9a5
commit d86757129a
3 changed files with 7 additions and 6 deletions

View file

@ -2094,7 +2094,7 @@ class ActionBlog extends Action
$this->Session_Drop('sBlogAvatarFilePreviewTmp');
$this->Viewer_AssignAjax('upload_text', $this->Lang_Get('user.photo.actions.change_photo'));
$this->Viewer_AssignAjax('photo', $oBlog->getAvatarPath());
$this->Viewer_AssignAjax('photo', $oBlog->getAvatarPath('500crop'));
} else {
$this->Message_AddError(is_string($res) ? $res : $this->Lang_Get('error'));
}
@ -2144,7 +2144,7 @@ class ActionBlog extends Action
$this->Blog_UpdateBlog($oBlog);
$this->Viewer_AssignAjax('upload_text', $this->Lang_Get('user.photo.actions.upload_photo'));
$this->Viewer_AssignAjax('photo', $oBlog->getAvatarPath());
$this->Viewer_AssignAjax('photo', $oBlog->getAvatarPath('500crop'));
$this->Viewer_AssignAjax('avatars', $oBlog->GetProfileAvatarsPath());
}

View file

@ -1051,6 +1051,7 @@ class ModuleBlog extends Module
if ($oBlog->getAvatar()) {
$this->Media_RemoveImageBySizes($oBlog->getAvatar(), Config::Get('module.blog.avatar_size'));
}
$oBlog->setAvatar(null);
}
/**

View file

@ -225,13 +225,13 @@ class ModuleBlog_EntityBlog extends Entity
*/
public function getAvatarPath($iSize = 48)
{
if (is_numeric($iSize)) {
$iSize .= 'crop';
}
if ($sPath = $this->getAvatar()) {
if (is_numeric($iSize)) {
$iSize .= 'crop';
}
return $this->Media_GetImageWebPath($sPath, $iSize);
} else {
return Config::Get('path.skin.assets.web') . '/images/avatars/avatar_blog_' . $iSize . 'x' . $iSize . '.png';
return $this->Media_GetImagePathBySize(Config::Get('path.skin.assets.web') . '/images/avatars/avatar_blog.png', $iSize);
}
}