############################################################## ## 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.3 ## ## Installation Level: Easy ## Installation Time: 5 Minutes ## Files To Edit: viewtopic.php ## groupcp.php ## memberlist.php ## includes/usercp_viewprofile.php ## includes/usercp_register.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 tag. ## ## NOTE: It does not resize the actual image, just scales it in the HTML codes ## ############################################################## ## 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 (no change from 1.1.2) ## ## 2004-09-15 - Version 1.1.3 ## - Added the resize to the edit profile page ## ## 2004-09-20 - Version 1.1.3a ## - Re-submitted to MOD database (no change from 1.1.3) ## ## ############################################################## ## 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'] ) ? '' : ''; 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'] ) ? '' : ''; // 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'] ) ? '' : ''; 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'] ) ? '' : ''; // 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'] ) ? '' : ''; 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'] ) ? '' : ''; // 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'] ) ? '' : ''; 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'] ) ? '' : ''; // break; // case USER_AVATAR_REMOTE: $avatar_img = resize_avatar($profiledata['user_avatar']); break; // // END MOD # #-----[ OPEN ]------------------------------------------ # includes/usercp_register.php # #-----[ FIND ]------------------------------------------ # case USER_AVATAR_REMOTE: $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '' : ''; 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'] ) ? '' : ''; // break; // case USER_AVATAR_REMOTE: $avatar_img = resize_avatar($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'] ) ? '' : ''; } // // 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