Resize Remote Avatars

Ответы на вопросы, связанные с модами для phpBB 2.0.x, кроме относящихся к форуму Для авторов (phpBB 2.0.x).
Аватара пользователя
severnet
phpBB 2.0.5
Сообщения: 490
Стаж: 20 лет 5 месяцев
Откуда: Санкт-Петербург

Resize Remote Avatars

Сообщение severnet »

Получил сообщение от посетителей моего форума, что аватар не уменьшается. Вопрос, мод сжимает размер картинки, а также вес?

Код: Выделить всё

############################################################## 
## MOD Title: Resize Remote Avatars v1.0.0 
## 
## MOD Author: Scott Ellis < srellis@orci.com > (Scott Ellis) 
## 
## MOD Description: 
## 
## Dynamically resize remote avatars to fit the maximum size set in the admin control panel 
## - users can link their avatar to any image on the web and it will be 
## automatically resized to fit the maximum dimensions set in the ACP 
## - aspect ratio is maintained 
## 
## MOD Version: 1.0.0 
## 
## Installation Level: Easy 
## 
## Installation Time: < 1 Minute 
## 
## Files To Edit: viewtopic.php 
## 
## Included Files: n/a 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## ----------- 
## developed and tested on phpBB 2.0.6 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ OPEN ]------------------------------------------ 
# 
viewtopic.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : ''; 
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
//////////////////////////////////////////////////////// 
// Resize Remote Avatars mod 
// Make sure that both dimensions of remote avatars conform to the limits 
// set in the admin control panel. Use the width and height attributes 
// on the <img> tag to control the image size in the browser. 
// Reduce the largest dimension of the remote image to the maximum allowed 
// in the ACP, then reduce the other dimension to maintain the aspect ratio. 
// 
// phpbb 2.0.6 impl 
// $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : ''; 

// new impl 
list($width, $height) = @getimagesize($postrow[$i]['user_avatar']); 
$width_attr = ''; 
$height_attr = ''; 
// resize the avatar in the browser if either dimension is too large 
$resize = $width > $board_config['avatar_max_width'] || $height > $board_config['avatar_max_height']; 

// set max dimension and adjust the other according to the ratio 
if ( $resize ) 
{ 
if ( $width == $height ) 
{ 
$width_attr = ' width="' . $board_config['avatar_max_width'] . '"'; 
$height_attr = ' height="' . $board_config['avatar_max_height'] . '"'; 
} 
else if ( $width > $height ) 
{ 
$width_attr = ' width="' . $board_config['avatar_max_width'] . '"'; 
$height_attr = ' height="' . $board_config['avatar_max_width'] * $height / $width . '"'; 
} 
else // $height > $width 
{ 
$width_attr = ' width="' . $board_config['avatar_max_height'] * $width / $height . '"'; 
$height_attr = ' height="' . $board_config['avatar_max_height'] . '"'; 
} 
} 
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0"' . $width_attr . $height_attr . '/>' : ''; 
// end Resize Remote Avatars mod 
//////////////////////////////////////////////////////// 
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
Изображение
Аватара пользователя
[R: R@m$e$ :U]
phpBB Maniac
Сообщения: 1464
Стаж: 20 лет 3 месяца
Откуда: Novosibirsk,RU

Сообщение [R: R@m$e$ :U] »

тут вроде ясно написано, что уменьшается только размер аватары... и то это сложно назвать уменьшением... тк это делается за счет просто указания width и height для картинки...
Руководство пользователя | FAQ | Правила | Как устанавливать MOD'ы
ВОСПОЛЬЗУЙСЯ ПОИСКОМ, ТАМ ЕСТЬ БОЛЬШИНСТВО ОТВЕТОВ
ЕСЛИ НЕ ПОМОГЛО, ИСПОЛЬЗУЙ ШАБЛОН ЗАПРОСА, ПОМОГИ В РЕШЕНИИ ЗАДАЧИ
БЕСПЛАТНО ПОМОГУ ТОЛЬКО НА ФОРУМЕ!!! (ЛС НЕ В СЧЕТ)

Оставь благодарность, подтверди работоспособность совета.

ВСЕ ПРАВА НА МОДЫ ОТДАНЫ m157y
Аватара пользователя
severnet
phpBB 2.0.5
Сообщения: 490
Стаж: 20 лет 5 месяцев
Откуда: Санкт-Петербург

Сообщение severnet »

[R: R@m$e$ :U], как ты думаешь этот мод стоит того, чтобы его устанавливать? :?:
Изображение
Аватара пользователя
[R: R@m$e$ :U]
phpBB Maniac
Сообщения: 1464
Стаж: 20 лет 3 месяца
Откуда: Novosibirsk,RU

Сообщение [R: R@m$e$ :U] »

severnet
имхо, нет... =)
Руководство пользователя | FAQ | Правила | Как устанавливать MOD'ы
ВОСПОЛЬЗУЙСЯ ПОИСКОМ, ТАМ ЕСТЬ БОЛЬШИНСТВО ОТВЕТОВ
ЕСЛИ НЕ ПОМОГЛО, ИСПОЛЬЗУЙ ШАБЛОН ЗАПРОСА, ПОМОГИ В РЕШЕНИИ ЗАДАЧИ
БЕСПЛАТНО ПОМОГУ ТОЛЬКО НА ФОРУМЕ!!! (ЛС НЕ В СЧЕТ)

Оставь благодарность, подтверди работоспособность совета.

ВСЕ ПРАВА НА МОДЫ ОТДАНЫ m157y

Вернуться в «Поддержка модов для phpBB 2.0.x»