mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
fix upload file
This commit is contained in:
parent
aa83293766
commit
80ee61b9ed
|
@ -774,7 +774,11 @@ class LsBlog extends Module {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sFileTmp=$aFile['tmp_name'];
|
$sFileTmp=Config::Get('sys.cache.dir').func_generator();
|
||||||
|
if (!move_uploaded_file($aFile['tmp_name'],$sFileTmp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$sPath=$this->Image_GetIdDir($oBlog->getOwnerId());
|
$sPath=$this->Image_GetIdDir($oBlog->getOwnerId());
|
||||||
$aParams=$this->Image_BuildParams('avatar');
|
$aParams=$this->Image_BuildParams('avatar');
|
||||||
|
|
||||||
|
@ -786,6 +790,7 @@ class LsBlog extends Module {
|
||||||
if($sError=$oImage->get_last_error()) {
|
if($sError=$oImage->get_last_error()) {
|
||||||
// Вывод сообщения об ошибки, произошедшей при создании объекта изображения
|
// Вывод сообщения об ошибки, произошедшей при создании объекта изображения
|
||||||
// $this->Message_AddError($sError,$this->Lang_Get('error'));
|
// $this->Message_AddError($sError,$this->Lang_Get('error'));
|
||||||
|
@unlink($sFileTmp);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -796,12 +801,13 @@ class LsBlog extends Module {
|
||||||
if ($oImage && $sFileAvatar=$this->Image_Resize($sFileTmp,$sPath,"avatar_blog_{$oBlog->getUrl()}_48x48",3000,3000,48,48,false,$aParams,$oImage)) {
|
if ($oImage && $sFileAvatar=$this->Image_Resize($sFileTmp,$sPath,"avatar_blog_{$oBlog->getUrl()}_48x48",3000,3000,48,48,false,$aParams,$oImage)) {
|
||||||
$this->Image_Resize($sFileTmp,$sPath,"avatar_blog_{$oBlog->getUrl()}_24x24",3000,3000,24,24,false,$aParams,$oImage);
|
$this->Image_Resize($sFileTmp,$sPath,"avatar_blog_{$oBlog->getUrl()}_24x24",3000,3000,24,24,false,$aParams,$oImage);
|
||||||
$this->Image_Resize($sFileTmp,$sPath,"avatar_blog_{$oBlog->getUrl()}",3000,3000,null,null,false,$aParams,$oImage);
|
$this->Image_Resize($sFileTmp,$sPath,"avatar_blog_{$oBlog->getUrl()}",3000,3000,null,null,false,$aParams,$oImage);
|
||||||
|
@unlink($sFileTmp);
|
||||||
/**
|
/**
|
||||||
* Если все нормально, возвращаем расширение загруженного аватара
|
* Если все нормально, возвращаем расширение загруженного аватара
|
||||||
*/
|
*/
|
||||||
return $this->Image_GetWebPath($sFileAvatar);
|
return $this->Image_GetWebPath($sFileAvatar);
|
||||||
}
|
}
|
||||||
|
@unlink($sFileTmp);
|
||||||
/**
|
/**
|
||||||
* В случае ошибки, возвращаем false
|
* В случае ошибки, возвращаем false
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1308,13 +1308,18 @@ class LsTopic extends Module {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sFileTmp=Config::Get('sys.cache.dir').func_generator();
|
||||||
|
if (!move_uploaded_file($aFile['tmp_name'],$sFileTmp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$sDirUpload=$this->Image_GetIdDir($oUser->getId());
|
$sDirUpload=$this->Image_GetIdDir($oUser->getId());
|
||||||
$sFileTmp=$aFile['tmp_name'];
|
|
||||||
$aParams=$this->Image_BuildParams('topic');
|
$aParams=$this->Image_BuildParams('topic');
|
||||||
|
|
||||||
if ($sFileImage=$this->Image_Resize($sFileTmp,$sDirUpload,func_generator(6),3000,3000,Config::Get('view.img_resize_width'),null,true,$aParams)) {
|
if ($sFileImage=$this->Image_Resize($sFileTmp,$sDirUpload,func_generator(6),3000,3000,Config::Get('view.img_resize_width'),null,true,$aParams)) {
|
||||||
|
@unlink($sFileTmp);
|
||||||
return $this->Image_GetWebPath($sFileImage);
|
return $this->Image_GetWebPath($sFileImage);
|
||||||
}
|
}
|
||||||
|
@unlink($sFileTmp);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1067,7 +1067,10 @@ class LsUser extends Module {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sFileTmp=$aFile['tmp_name'];
|
$sFileTmp=Config::Get('sys.cache.dir').func_generator();
|
||||||
|
if (!move_uploaded_file($aFile['tmp_name'],$sFileTmp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$sPath = $this->Image_GetIdDir($oUser->getId());
|
$sPath = $this->Image_GetIdDir($oUser->getId());
|
||||||
$aParams=$this->Image_BuildParams('avatar');
|
$aParams=$this->Image_BuildParams('avatar');
|
||||||
|
|
||||||
|
@ -1082,6 +1085,7 @@ class LsUser extends Module {
|
||||||
if($sError=$oImage->get_last_error()) {
|
if($sError=$oImage->get_last_error()) {
|
||||||
// Вывод сообщения об ошибки, произошедшей при создании объекта изображения
|
// Вывод сообщения об ошибки, произошедшей при создании объекта изображения
|
||||||
// $this->Message_AddError($sError,$this->Lang_Get('error'));
|
// $this->Message_AddError($sError,$this->Lang_Get('error'));
|
||||||
|
@unlink($sFileTmp);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1094,12 +1098,13 @@ class LsUser extends Module {
|
||||||
$this->Image_Resize($sFileTmp,$sPath,'avatar_48x48',3000,3000,48,48,false,$aParams);
|
$this->Image_Resize($sFileTmp,$sPath,'avatar_48x48',3000,3000,48,48,false,$aParams);
|
||||||
$this->Image_Resize($sFileTmp,$sPath,'avatar_24x24',3000,3000,24,24,false,$aParams);
|
$this->Image_Resize($sFileTmp,$sPath,'avatar_24x24',3000,3000,24,24,false,$aParams);
|
||||||
$this->Image_Resize($sFileTmp,$sPath,'avatar',3000,3000,null,null,false,$aParams);
|
$this->Image_Resize($sFileTmp,$sPath,'avatar',3000,3000,null,null,false,$aParams);
|
||||||
|
@unlink($sFileTmp);
|
||||||
/**
|
/**
|
||||||
* Если все нормально, возвращаем расширение загруженного аватара
|
* Если все нормально, возвращаем расширение загруженного аватара
|
||||||
*/
|
*/
|
||||||
return $this->Image_GetWebPath($sFileAvatar);
|
return $this->Image_GetWebPath($sFileAvatar);
|
||||||
}
|
}
|
||||||
|
@unlink($sFileTmp);
|
||||||
/**
|
/**
|
||||||
* В случае ошибки, возвращаем false
|
* В случае ошибки, возвращаем false
|
||||||
*/
|
*/
|
||||||
|
@ -1135,17 +1140,22 @@ class LsUser extends Module {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sFileTmp=Config::Get('sys.cache.dir').func_generator();
|
||||||
|
if (!move_uploaded_file($aFile['tmp_name'],$sFileTmp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$sDirUpload=$this->Image_GetIdDir($oUser->getId());
|
$sDirUpload=$this->Image_GetIdDir($oUser->getId());
|
||||||
$sFileTmp=$aFile['tmp_name'];
|
|
||||||
$aParams=$this->Image_BuildParams('foto');
|
$aParams=$this->Image_BuildParams('foto');
|
||||||
|
|
||||||
if ($sFileFoto=$this->Image_Resize($sFileTmp,$sDirUpload,func_generator(6),3000,3000,250,null,true,$aParams)) {
|
if ($sFileFoto=$this->Image_Resize($sFileTmp,$sDirUpload,func_generator(6),3000,3000,250,null,true,$aParams)) {
|
||||||
|
@unlink($sFileTmp);
|
||||||
/**
|
/**
|
||||||
* удаляем старое фото
|
* удаляем старое фото
|
||||||
*/
|
*/
|
||||||
$this->DeleteFoto($oUser);
|
$this->DeleteFoto($oUser);
|
||||||
return $this->Image_GetWebPath($sFileFoto);
|
return $this->Image_GetWebPath($sFileFoto);
|
||||||
}
|
}
|
||||||
|
@unlink($sFileTmp);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue