|
Page 1 of 2
|
AvrilBoi
Joined: August 2006
Posts: 45
Location:
|
First Poster's Avatar's Width And Height
I dunno if this is a real bug... anyway, the avatar (remotely hosted) of the person who opens a topic is 80x80 even if in the configuration of the max avatar width and height isn't set to 80x80.
The "bug" is in functions.php, line 1878
find:
return ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $avatar_url . '" width="80" height="80" alt="" border="0" />' : '';
replace with:
return ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $avatar_url . '" alt="" border="0" />' : '';
|
#1 Wed 23 Aug, 2006 12:50 |
|
Sponsors
|
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.
|
|
lenitron
Joined: August 2006
Posts: 7
Location:
|
Respuesta: First Poster's Avatar's Width And Height
Thanks AvrilBoi. I have replaced that line but now the remote avatars are not resized to the size that I have assigned in the ACP...
Why?
Sorry for my bad english
In Spanish:
Gracias AvrilBoy. Yo he remplazado esa linea pero ahora los avatares externos no son redimensionados al tamaño que he puesto de maximo en el ACP...
¿Porque?
|
#2 Fri 25 Aug, 2006 11:54 |
|
AvrilBoi
Joined: August 2006
Posts: 45
Location:
|
Re: First Poster's Avatar's Width And Height
Don't worry, your English is good and understandable.
I don't know very well php, someone who is expert should find a solution to resize proportionally the remotely hosted avatars.
For now I prefer having the remotely hosted avatars in the original size than having them 80x80, and if I find someone who passes my limits, I'll send him a PM, because the limits are written in the general furum's rules.
Anyway you can disallow users to use remotely hosted avatars, so the only thing they can do is to upload or transload only avatars which don't pass the limits you set.
|
#3 Fri 25 Aug, 2006 12:43 |
|
lenitron
Joined: August 2006
Posts: 7
Location:
|
Respuesta: First Poster's Avatar's Width And Height
Don't worry, your English is good and understandable.
I don't know very well php, someone who is expert should find a solution to resize proportionally the remotely hosted avatars.
For now I prefer having the remotely hosted avatars in the original size than having them 80x80, and if I find someone who passes my limits, I'll send him a PM, because the limits are written in the general furum's rules.
Anyway you can disallow users to use remotely hosted avatars, so the only thing they can do is to upload or transload only avatars which don't pass the limits you set.
Thanks, I will do that while we found some solution.
I think that it would be possible to adapt the code used for resize proportionally hosted avatars, for the remotely hosted avatars...
If this is possible, I believe that it isn't difficult...
Somebody can do it?
|
#4 Sun 27 Aug, 2006 13:42 |
|
Mighty Gorgon
Luca Libralato
Joined: August 2006
Posts: 7191
Location: Borgo San Michele
|
Re: First Poster's Avatar's Width And Height
A check on the image should be performed to make sure that proportion are maintaned...
Anyway, what I suggest is to set just the width (which is the dimension which causes stretching) and leave the height as float. This will be a problem only with tall images... but it's better than having stretched images...
Try this:
- return ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $avatar_url . '" width="80" alt="" border="0" />' : '';
Let me know.
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#5 Sun 27 Aug, 2006 15:40 |
|
AvrilBoi
Joined: August 2006
Posts: 45
Location:
|
Re: First Poster's Avatar's Width And Height
but it's better than having stretched images...
But if an user has an avatar of 30 pixel in width, then the avatar will not be stretched but widened
So I still prefer having the remotely hosted avatars in the real size until we find a solution to resize them proportionally
|
#6 Sun 27 Aug, 2006 19:20 |
|
lenitron
Joined: August 2006
Posts: 7
Location:
|
Respuesta: First Poster's Avatar's Width And Height
but it's better than having stretched images...
But if an user has an avatar of 30 pixel in width, then the avatar will not be stretched but widened
So I still prefer having the remotely hosted avatars in the real size until we find a solution to resize them proportionally
Yes, I also
Thanks
|
#7 Sun 27 Aug, 2006 21:22 |
|
Mighty Gorgon
Luca Libralato
Joined: August 2006
Posts: 7191
Location: Borgo San Michele
|
Re: First Poster's Avatar's Width And Height
I think I have the solution, but since it may slow down page loading I won't add it to XS...
It uses getimagesize function:
function resize_avatar($avatar_url)
{
global $board_config;
$avatar_width = 80;
$avatar_height = 80;
if (function_exists('getimagesize'))
{
$pic_size = @getimagesize($avatar_url);
if ($pic_size != false)
{
$pic_width = $pic_size[0];
$pic_height = $pic_size[1];
if ( ($pic_width < 80) && ($pic_height < 80) )
{
$avatar_width = $pic_width;
$avatar_height = $pic_height;
}
elseif ($pic_width > $pic_height)
{
$avatar_width = 80;
$avatar_height = 80 * ($pic_height/$pic_width);
}
else
{
$avatar_height = 80;
$avatar_width = 80 * ($pic_width/$pic_height);
}
}
}
return ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $avatar_url . '" width="'. $avatar_width .'" height="' . $avatar_height .'" alt="" border="0" />' : '';
}
Can you try this and let me know if it works please?
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#8 Sun 27 Aug, 2006 21:41 |
|
AvrilBoi
Joined: August 2006
Posts: 45
Location:
|
Re: First Poster's Avatar's Width And Height
Sure I try it
Do I have to replace
- return ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $avatar_url . '" alt="" border="0" />' : '';
with the code you provided?
|
#9 Sun 27 Aug, 2006 21:43 |
|
Mighty Gorgon
Luca Libralato
Joined: August 2006
Posts: 7191
Location: Borgo San Michele
|
Re: First Poster's Avatar's Width And Height
The whole function...
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#10 Sun 27 Aug, 2006 21:50 |
|
AvrilBoi
Joined: August 2006
Posts: 45
Location:
|
Re: First Poster's Avatar's Width And Height
I did it.
Here's what I gotta say
- thanks for providing the modification
- it works but doesn't use my configuration for the max. avatar width and height, but it uses 80px as maximum width and height
- it slows down the forum tooooooo much (you said that)
A solution for making the forum unslow could be to simply add the check for remotely hosted avatars just when the user changes / adds his remot. hosted avatar. If the avatar passes the limits, he has to put another url, if the avatar doesn't pass the limits, the remotely hosted avatar's url is saved in the profile...
|
#11 Sun 27 Aug, 2006 22:07 |
|
Mighty Gorgon
Luca Libralato
Joined: August 2006
Posts: 7191
Location: Borgo San Michele
|
Re: First Poster's Avatar's Width And Height
He he he... I know that getimagesize function is a pain in the ass for most host...
Many users have problems with that function, and most of the images problems are related to that one.
At the moment I don't have the time to modify the remote avatar feature... you may do some test if you wish... you can use the same function...
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#12 Sun 27 Aug, 2006 22:11 |
|
AvrilBoi
Joined: August 2006
Posts: 45
Location:
|
Re: First Poster's Avatar's Width And Height
Ok Mighty, I'll do some tests by myself... ^^ But can you just tell me which is the file to modify? The one that has to check for the remotely hosted avatar when the users changes his avatar. Maybe usercp_avatar.php ? thanks
|
#13 Sun 27 Aug, 2006 22:16 |
|
Mighty Gorgon
Luca Libralato
Joined: August 2006
Posts: 7191
Location: Borgo San Michele
|
Re: First Poster's Avatar's Width And Height
Of course...
includes/usercp_avatar.php
Enjoy!
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#14 Sun 27 Aug, 2006 22:21 |
|
AvrilBoi
Joined: August 2006
Posts: 45
Location:
|
Re: First Poster's Avatar's Width And Height
I found a mod for phpbb that is (almost) fully compatible with xs.
Maybe you can include this in the next patch/release of XS .
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_avatar.php
#
#-----[ FIND ]------------------------------------------
#
return ( $mode == 'editprofile' ) ? ", user_avatar = '" . str_replace("'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_REMOTE : '';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start Remote Avatar Check Mod
global $board_config;
$remote_file = @fopen ($avatar_filename, "rb");
if(!$remote_file)
{
$error = true;
$error_msg = sprintf($lang['Remote_avatar_no_image'], $avatar_filename);
return;
}
$user_avatar_size = 0;
do
{
if (strlen(@fread($remote_file, 1)) == 0 || $user_avatar_size > $board_config['avatar_filesize'])
{
break;
}
$user_avatar_size ++;
}
while(true);
@fclose($remote_file);
if($user_avatar_size > $board_config['avatar_filesize'])
{
$error = true;
$error_msg = sprintf($lang['Remote_avatar_error_filesize'], $board_config['avatar_filesize']);
return;
}
list($user_avatar_width, $user_avatar_height) = @getimagesize($avatar_filename);
if($user_avatar_width > $board_config['avatar_max_width'] || $user_avatar_height > $board_config['avatar_max_height'])
{
$error = true;
$error_msg = sprintf($lang['Remote_avatar_error_dimension'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);
return;
}
// End Remote Avatar Check Mod
#
#-----[ OPEN ] (do it with each language if you need to)
#
language/lang_*/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// Common, these terms are used
// extensively on several pages
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start Remote Avatar Check Mod
$lang['Remote_avatar_no_image'] = 'The image %s does not exist';
$lang['Remote_avatar_error_filesize'] = 'The image is over the size limit for avatars (%d Bytes)';
$lang['Remote_avatar_error_dimension'] = 'The image is over the dimension limit for avatars (%d x %d pixels)';
// End Remote Avatar Check Mod
Here's also the patch (including Italian language file).
Description: |
|
Download |
Filename: |
check_remote_avatar.zip |
Filesize: |
59.46 KB |
Downloaded: |
266 Time(s) |
|
#15 Sun 27 Aug, 2006 23:33 |
|
|
Page 1 of 2
|
Was this topic useful?
Was this topic useful?
Link this topic |
URL |
|
BBCode |
|
HTML |
|
You cannot post new topics You cannot reply to topics You cannot edit your posts You cannot delete your posts You cannot vote in polls You cannot attach files You can download files You cannot post calendar events
|
|
|
|