View previous topic :: View next topic |
Author |
Message |
Kilgamayan Trick Member
Joined: 04 May 2005 Location: lol internet |
0. Posted: Mon Jun 13, 2005 8:18 pm Post subject: Avatar size mod |
|
|
Spectere and I have access to the phpBB mod that resizes avatars if they're beyond a certain size, but we're looking for the one that prevents people from linking to said oversized avatars entirely.
I remembered you guys have the mod we're looking for. Where can we get it? _________________
|
|
Back to top |
|
|
sherl0k Maniac Member
Joined: 27 Jan 2002 Location: the internet |
|
Back to top |
|
|
Cutriss Staff Member
Joined: 24 Jan 2002
|
2. Posted: Tue Jun 14, 2005 4:20 am Post subject: |
|
|
Resizing avatars is easy. You just adjust the assignment of the $poster_avatar variable in viewtopic.php by changing the <img> tag to add height and width attributes. You can set it statically here, or add to the previous SQL query to fetch configuration values out of the database. Of course, the trick is if you want to resize *only* the oversized avatars. And if that's the case (which is probably what this mod you're talking about deals with), then you would have to do server-side storage and manipulation of the avatars on a case-by-case basis (IE - if the image is greater than 64x64, resize it and substitute in the stored version, but if not, then just link it). That's entirely too much of a headache, so we just block everything that's too big.
To block stuff you have to add some extra validation lines in includes/usercp_avatar.php which fetch the image, check its dimensions/filesize, and then act accordingly. If you're nice, you'll probably also need to add some additional error messages to your lang_main.php file so that you can tell the user more about why you're rejecting his/her avatar. _________________
Sentient Mode is capable... |
|
Back to top |
|
|
Kilgamayan Trick Member
Joined: 04 May 2005 Location: lol internet |
3. Posted: Tue Jun 14, 2005 12:46 pm Post subject: |
|
|
Can we use that same coding idea to block certain file sizes as well? _________________
|
|
Back to top |
|
|
Cutriss Staff Member
Joined: 24 Jan 2002
|
4. Posted: Tue Jun 14, 2005 3:48 pm Post subject: |
|
|
Pretty much.
Assuming you're familiar enough with PHP to muck around with the code yourself, I think there's a fairly straight-forward piece of code when you look up the fsockopen and fgets methods which illustrates how to do it.
EDIT: Ah - here's the page I was thinking of, I think.
What I did was to "borrow" the phpBB config variable which controls the maximum filesize for uploaded avatars. Since we have no plan to ever host user avatars via phpBB, and even if we did, I'm sure the filesize restrictions would be the same, I can safely use that as a dynamic control to dictate the filesize restriction, instead of hardcoding a particular size in the routine in usercp_avatar.php. _________________
Sentient Mode is capable... |
|
Back to top |
|
|
Spectere Trick Member
Joined: 23 Jan 2004
|
5. Posted: Tue Jun 14, 2005 8:58 pm Post subject: |
|
|
Thanks for the run-down, Cutriss. I'll give coding that a shot...if I have any problems you can count on me being back to bug you guys again. XD |
|
Back to top |
|
|
|