Changeset 931

Show
Ignore:
Timestamp:
06/05/10 20:05:38 (20 months ago)
Author:
ort
Message:

возможность в конфиге указывать размеры для ресайза аватаров юзера и блога

Location:
trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/classes/actions/ActionSettings.class.php

    r756 r931  
    277277                                $aUserAvatars = array(); 
    278278                                if($sPathOld) { 
    279                                         foreach (array(100,64,48,24,0) as $iSize) { 
     279                                        foreach (array_merge(Config::Get('module.user.avatar_size'),array(100)) as $iSize) { 
    280280                                                $aUserAvatars[$iSize] = $this->oUserCurrent->getProfileAvatarPath($iSize); 
    281281                                        } 
  • trunk/classes/modules/blog/Blog.class.php

    r929 r931  
    797797                 
    798798                if ($oImage && $sFileAvatar=$this->Image_Resize($sFileTmp,$sPath,"avatar_blog_{$oBlog->getUrl()}_48x48",Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),48,48,false,$aParams,$oImage)) { 
    799                         $this->Image_Resize($sFileTmp,$sPath,"avatar_blog_{$oBlog->getUrl()}_24x24",Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),24,24,false,$aParams,$oImage); 
    800                         $this->Image_Resize($sFileTmp,$sPath,"avatar_blog_{$oBlog->getUrl()}",Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),null,null,false,$aParams,$oImage); 
     799                        $aSize=Config::Get('module.blog.avatar_size'); 
     800                        foreach ($aSize as $iSize) { 
     801                                if ($iSize==0) { 
     802                                        $this->Image_Resize($sFileTmp,$sPath,"avatar_blog_{$oBlog->getUrl()}",Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),null,null,false,$aParams,$oImage); 
     803                                } else { 
     804                                        $this->Image_Resize($sFileTmp,$sPath,"avatar_blog_{$oBlog->getUrl()}_{$iSize}x{$iSize}",Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),$iSize,$iSize,false,$aParams,$oImage); 
     805                                } 
     806                        } 
    801807                        @unlink($sFileTmp); 
    802808                        /** 
     
    821827                 */ 
    822828                if($oBlog->getAvatar()) {                
    823                         @unlink($this->Image_GetServerPath($oBlog->getAvatarPath(48))); 
    824                         @unlink($this->Image_GetServerPath($oBlog->getAvatarPath(24))); 
    825                         @unlink($this->Image_GetServerPath($oBlog->getAvatarPath(0)));           
     829                        $aSize=array_merge(Config::Get('module.blog.avatar_size'),array(48)); 
     830                        foreach ($aSize as $iSize) { 
     831                                @unlink($this->Image_GetServerPath($oBlog->getAvatarPath($iSize))); 
     832                        }                
    826833                } 
    827834        }        
  • trunk/classes/modules/user/User.class.php

    r929 r931  
    10911091                $oImage->output(null,$sFileTmp); 
    10921092                 
    1093                 if ($sFileAvatar=$this->Image_Resize($sFileTmp,$sPath,'avatar_100x100',Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),100,100,false,$aParams)) { 
    1094                         $this->Image_Resize($sFileTmp,$sPath,'avatar_64x64',Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),64,64,false,$aParams); 
    1095                         $this->Image_Resize($sFileTmp,$sPath,'avatar_48x48',Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),48,48,false,$aParams); 
    1096                         $this->Image_Resize($sFileTmp,$sPath,'avatar_24x24',Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),24,24,false,$aParams); 
    1097                         $this->Image_Resize($sFileTmp,$sPath,'avatar',Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),null,null,false,$aParams); 
     1093                if ($sFileAvatar=$this->Image_Resize($sFileTmp,$sPath,'avatar_100x100',Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),100,100,false,$aParams)) {                   
     1094                        $aSize=Config::Get('module.user.avatar_size'); 
     1095                        foreach ($aSize as $iSize) { 
     1096                                if ($iSize==0) { 
     1097                                        $this->Image_Resize($sFileTmp,$sPath,'avatar',Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),null,null,false,$aParams); 
     1098                                } else { 
     1099                                        $this->Image_Resize($sFileTmp,$sPath,"avatar_{$iSize}x{$iSize}",Config::Get('view.img_max_width'),Config::Get('view.img_max_height'),$iSize,$iSize,false,$aParams); 
     1100                                } 
     1101                        } 
    10981102                        @unlink($sFileTmp); 
    10991103                        /** 
     
    11181122                 */ 
    11191123                if($oUser->getProfileAvatar()) { 
    1120                         @unlink($this->Image_GetServerPath($oUser->getProfileAvatarPath(100))); 
    1121                         @unlink($this->Image_GetServerPath($oUser->getProfileAvatarPath(64))); 
    1122                         @unlink($this->Image_GetServerPath($oUser->getProfileAvatarPath(48))); 
    1123                         @unlink($this->Image_GetServerPath($oUser->getProfileAvatarPath(24))); 
    1124                         @unlink($this->Image_GetServerPath($oUser->getProfileAvatarPath(0))); 
     1124                        $aSize=array_merge(Config::Get('module.user.avatar_size'),array(100)); 
     1125                        foreach ($aSize as $iSize) { 
     1126                                @unlink($this->Image_GetServerPath($oUser->getProfileAvatarPath($iSize))); 
     1127                        } 
    11251128                } 
    11261129        } 
  • trunk/config/config.php

    r909 r931  
    153153$config['module']['blog']['index_good']      =  8;   // Рейтинг топика выше которого(включительно) он попадает на главную 
    154154$config['module']['blog']['encrypt']         = 'livestreet'; // Ключ XXTEA шифрования идентификаторов в ссылках приглашения в блоги 
     155$config['module']['blog']['avatar_size'] = array(24,0); // Список размеров аватаров у блога. 0 - исходный размер 
    155156// Модуль Topic 
    156157$config['module']['topic']['new_time']   = 60*60*24*1;  // Время в секундах в течении которого топик считается новым 
     
    162163$config['module']['user']['friend_notice']['accept'] = false; // Отправить talk-сообщение в случае одобрения заявки на добавление в друзья 
    163164$config['module']['user']['friend_notice']['reject'] = false; // Отправить talk-сообщение в случае отклонения заявки на добавление в друзья 
     165$config['module']['user']['avatar_size'] = array(64,48,24,0); // Список размеров аватаров у пользователя. 0 - исходный размер  
    164166// Модуль Comment 
    165167$config['module']['comment']['per_page'] = 20;          // Число комментариев на одну страницу(это касается только полного списка комментариев прямого эфира)