ciahchal
4 November 2004, 08:36 AM
اين رو من بصورت تصادفي توي يك فروم ديدم
################################################## ############
## MOD Title: Remote Avatar Resize
## MOD Author: tomlevens < tom@tomlevens.co.uk > (Tom Levens) http://www.tomlevens.co.uk/
## MOD Description: A simple MOD to resize user's remote avatar if it is larger than the maximum size set in the admin panel.
## MOD Version: 1.1.2a
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit: viewtopic.php
## groupcp.php
## memberlist.php
## includes/usercp_viewprofile.php
## includes/functions.php
## language/lang_english/lang_main.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:
##
## This is a simple MOD to resize the user's remote avatar if it is larger than the
## maximum size set in the admin control panel. It does so through the size constraints
## in the HTML <img> tag.
##
## NOTE: It does not resize the actual image, just scales it in the HTML code.
##
################################################## ############
## MOD History:
##
##ت ت2004-01-26 - Version 1.0.0
##ت ت ت - Initial Release
##
##ت ت2004-01-26 - Version 1.0.1
##ت ت ت - Fixed a small bug that caused php to report an error if the file link was dead
##
##ت ت2004-08-10 - Version 1.1.0
##ت ت ت - Complete rewrite, now uses a function to resize the image
##
##ت ت2004-08-10 - Version 1.1.1
##ت ت ت - Fixed an error in the .mod file syntax
##
##ت ت2004-09-02 - Version 1.1.2
##ت ت ت - Fixed a small bug that prevented display in memberlist.php
##
##ت ت2004-09-09 - Version 1.1.2a
##ت ت ت - Re-submitted to MOD database
##
################################################## ############
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
################################################## ############
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
break;
#
#-----[ REPLACE WITH ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (3 lines replaced - original lines follow)
//
// case USER_AVATAR_REMOTE:
// $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
// break;
//
case USER_AVATAR_REMOTE:
$poster_avatar = resize_avatar($postrow[$i]['user_avatar']);
break;
//
// END MOD
#
#-----[ OPEN ]------------------------------------------
#
groupcp.php
#
#-----[ FIND ]------------------------------------------
#
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
break;
#
#-----[ REPLACE WITH ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (3 lines replaced - original lines follow)
//
// case USER_AVATAR_REMOTE:
// $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
// break;
//
case USER_AVATAR_REMOTE:
$poster_avatar = resize_avatar($row['user_avatar']);
break;
//
// END MOD
#
#-----[ OPEN ]------------------------------------------
#
memberlist.php
#
#-----[ FIND ]------------------------------------------
#
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
break;
#
#-----[ REPLACE WITH ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (3 lines replaced - original lines follow)
//
// case USER_AVATAR_REMOTE:
// $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
// break;
//
case USER_AVATAR_REMOTE:
$poster_avatar = resize_avatar($row['user_avatar']);
break;
//
// END MOD
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
break;
#
#-----[ REPLACE WITH ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (3 lines replaced - original lines follow)
//
// case USER_AVATAR_REMOTE:
// $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
// break;
//
case USER_AVATAR_REMOTE:
$avatar_img = resize_avatar($profiledata['user_avatar']);
break;
//
// END MOD
#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (30 lines added)
//
function resize_avatar($avatar_url) {
global $board_config;
list($avatar_width, $avatar_height) = @getimagesize($avatar_url);
if($avatar_width > $board_config['avatar_max_width'] && $avatar_height <= $board_config['avatar_max_height']) {
$cons_width = $board_config['avatar_max_width'];
$cons_height = round((($board_config['avatar_max_width'] * $avatar_height) / $avatar_width), 0);
}
elseif($avatar_width <= $board_config['avatar_max_width'] && $avatar_height > $board_config['avatar_max_height']) {
$cons_width = round((($board_config['avatar_max_height'] * $avatar_width) / $avatar_height), 0);
$cons_height = $board_config['avatar_max_height'];
}
elseif($avatar_width > $board_config['avatar_max_width'] && $avatar_height > $board_config['avatar_max_height']) {
if($avatar_width >= $avatar_height) {
$cons_width = $board_config['avatar_max_width'];
$cons_height = round((($board_config['avatar_max_width'] * $avatar_height) / $avatar_width), 0);
}
elseif($avatar_width < $avatar_height) {
$cons_width = round((($board_config['avatar_max_height'] * $avatar_width) / $avatar_height), 0);
$cons_height = $board_config['avatar_max_height'];
}
}
else {
$cons_width = $avatar_width;
$cons_height = $avatar_height;
}
return ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $avatar_url . '" width="' . $cons_width . '" height="' . $cons_height . '" alt="" border="0" />' : '';
}
//
// END MOD
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
# Full Line:
# $lang['Avatar_explain'] = 'Displays a small graphic image below your details in posts. Only one image can be displayed at a time, its width can be no greater than %d pixels, the height no greater than %d pixels, and the file size no more than %d KB.';
$lang['Avatar_explain'] =
#
#-----[ REPLACE WITH ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (1 line replaced - original lines follow)
//
// $lang['Avatar_explain'] = 'Displays a small graphic image below your details in posts. Only one image can be displayed at a time, its width can be no greater than %d pixels, the height no greater than %d pixels, and the file size no more than %d KB.';
//
$lang['Avatar_explain'] = 'Displays a small graphic image below your details in posts. Only one image can be displayed at a time. The dimensions of the image are restricted to a maximum of %d pixels wide, and %d pixels high. Uploaded avatars have a file size limit of %d KB, and must be less than or equal to the maximum dimensions. Remotely hosted avatars will be automatically scaled to fit these dimensions.';
//
// END MOD
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
طبق حرف اونجا با اين مد مي شه سايز آواتار ها رو مطابق تنظيم فرموده ادمين در پنل كرد ...
منبع http://upcoming.aaber.com/viewtopic.php?t=345
################################################## ############
## MOD Title: Remote Avatar Resize
## MOD Author: tomlevens < tom@tomlevens.co.uk > (Tom Levens) http://www.tomlevens.co.uk/
## MOD Description: A simple MOD to resize user's remote avatar if it is larger than the maximum size set in the admin panel.
## MOD Version: 1.1.2a
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit: viewtopic.php
## groupcp.php
## memberlist.php
## includes/usercp_viewprofile.php
## includes/functions.php
## language/lang_english/lang_main.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:
##
## This is a simple MOD to resize the user's remote avatar if it is larger than the
## maximum size set in the admin control panel. It does so through the size constraints
## in the HTML <img> tag.
##
## NOTE: It does not resize the actual image, just scales it in the HTML code.
##
################################################## ############
## MOD History:
##
##ت ت2004-01-26 - Version 1.0.0
##ت ت ت - Initial Release
##
##ت ت2004-01-26 - Version 1.0.1
##ت ت ت - Fixed a small bug that caused php to report an error if the file link was dead
##
##ت ت2004-08-10 - Version 1.1.0
##ت ت ت - Complete rewrite, now uses a function to resize the image
##
##ت ت2004-08-10 - Version 1.1.1
##ت ت ت - Fixed an error in the .mod file syntax
##
##ت ت2004-09-02 - Version 1.1.2
##ت ت ت - Fixed a small bug that prevented display in memberlist.php
##
##ت ت2004-09-09 - Version 1.1.2a
##ت ت ت - Re-submitted to MOD database
##
################################################## ############
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
################################################## ############
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
break;
#
#-----[ REPLACE WITH ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (3 lines replaced - original lines follow)
//
// case USER_AVATAR_REMOTE:
// $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
// break;
//
case USER_AVATAR_REMOTE:
$poster_avatar = resize_avatar($postrow[$i]['user_avatar']);
break;
//
// END MOD
#
#-----[ OPEN ]------------------------------------------
#
groupcp.php
#
#-----[ FIND ]------------------------------------------
#
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
break;
#
#-----[ REPLACE WITH ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (3 lines replaced - original lines follow)
//
// case USER_AVATAR_REMOTE:
// $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
// break;
//
case USER_AVATAR_REMOTE:
$poster_avatar = resize_avatar($row['user_avatar']);
break;
//
// END MOD
#
#-----[ OPEN ]------------------------------------------
#
memberlist.php
#
#-----[ FIND ]------------------------------------------
#
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
break;
#
#-----[ REPLACE WITH ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (3 lines replaced - original lines follow)
//
// case USER_AVATAR_REMOTE:
// $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
// break;
//
case USER_AVATAR_REMOTE:
$poster_avatar = resize_avatar($row['user_avatar']);
break;
//
// END MOD
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
break;
#
#-----[ REPLACE WITH ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (3 lines replaced - original lines follow)
//
// case USER_AVATAR_REMOTE:
// $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
// break;
//
case USER_AVATAR_REMOTE:
$avatar_img = resize_avatar($profiledata['user_avatar']);
break;
//
// END MOD
#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (30 lines added)
//
function resize_avatar($avatar_url) {
global $board_config;
list($avatar_width, $avatar_height) = @getimagesize($avatar_url);
if($avatar_width > $board_config['avatar_max_width'] && $avatar_height <= $board_config['avatar_max_height']) {
$cons_width = $board_config['avatar_max_width'];
$cons_height = round((($board_config['avatar_max_width'] * $avatar_height) / $avatar_width), 0);
}
elseif($avatar_width <= $board_config['avatar_max_width'] && $avatar_height > $board_config['avatar_max_height']) {
$cons_width = round((($board_config['avatar_max_height'] * $avatar_width) / $avatar_height), 0);
$cons_height = $board_config['avatar_max_height'];
}
elseif($avatar_width > $board_config['avatar_max_width'] && $avatar_height > $board_config['avatar_max_height']) {
if($avatar_width >= $avatar_height) {
$cons_width = $board_config['avatar_max_width'];
$cons_height = round((($board_config['avatar_max_width'] * $avatar_height) / $avatar_width), 0);
}
elseif($avatar_width < $avatar_height) {
$cons_width = round((($board_config['avatar_max_height'] * $avatar_width) / $avatar_height), 0);
$cons_height = $board_config['avatar_max_height'];
}
}
else {
$cons_width = $avatar_width;
$cons_height = $avatar_height;
}
return ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $avatar_url . '" width="' . $cons_width . '" height="' . $cons_height . '" alt="" border="0" />' : '';
}
//
// END MOD
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
# Full Line:
# $lang['Avatar_explain'] = 'Displays a small graphic image below your details in posts. Only one image can be displayed at a time, its width can be no greater than %d pixels, the height no greater than %d pixels, and the file size no more than %d KB.';
$lang['Avatar_explain'] =
#
#-----[ REPLACE WITH ]------------------------------------------
#
// MOD: Remote Avatar Resize - by tomlevens (tom@tomlevens.co.uk)
// (1 line replaced - original lines follow)
//
// $lang['Avatar_explain'] = 'Displays a small graphic image below your details in posts. Only one image can be displayed at a time, its width can be no greater than %d pixels, the height no greater than %d pixels, and the file size no more than %d KB.';
//
$lang['Avatar_explain'] = 'Displays a small graphic image below your details in posts. Only one image can be displayed at a time. The dimensions of the image are restricted to a maximum of %d pixels wide, and %d pixels high. Uploaded avatars have a file size limit of %d KB, and must be less than or equal to the maximum dimensions. Remotely hosted avatars will be automatically scaled to fit these dimensions.';
//
// END MOD
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
طبق حرف اونجا با اين مد مي شه سايز آواتار ها رو مطابق تنظيم فرموده ادمين در پنل كرد ...
منبع http://upcoming.aaber.com/viewtopic.php?t=345