Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Block animated avatars Details »»
Block animated avatars
Version: 1.00, by nso nso is offline
Developer Last Online: Aug 2021 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 02-21-2005 Last Update: Never Installs: 3
 
No support by the author.

On my forums we try to enhance the reading experience, and do not allow our members to use animated avatars. One of my members have written the following hack for my forums, and I got his permission to post it here on vbulletin.org.

What this hack does is to prevent your users from uploading an animated image. It does this by checking if the image contains more than one frame. It is not retroactive, and your current avatars will remain as is.

Hope you will enjoy this.

Changes:
1 New Phrase
1 File to edit (profile.php)

Installtime: 45 sec


In profile.php, find:
Code:
// ####################### SET PHP ENVIRONMENT ###########################
Above that, add:
Code:
// Block Animated Avatars Hack - by Scha at freakforum.nu
// start

function isAnimated($filename, $isurl = 0)
{
        $fp = fopen($filename, "rb");
        if(!$fp)
                return false;
        if($isurl)
                $whole = fread($fp, remote_filesize($filename));
        else
                $whole = fread($fp, filesize($filename));
        $i = -1;
        while($i = strpos($whole, 0x2C, $i+1))
        {
                if(strpos($whole, 0x00, $i-1) == $i-1)
                $c++;
        }
        if($c > 1)
                return true;
        return false;
}

// end
// Block Animated Avatars Hack - by Scha at freakforum.nu

In profile.php, find:
Code:
                if ($avatarid == 0)
                {
                        // begin custom avatar code
                      require_once('./includes/functions_upload.php');
                      require_once('./includes/functions_file.php');
REPLACE that with:
Code:
// Block Animated Avatars Hack - by Scha at freakforum.nu   
//start

                require_once('./includes/functions_upload.php');
                require_once('./includes/functions_file.php');

                if(isset($_FILES['upload']) && strtolower(substr($_FILES['upload']['name'], -3)) == 'gif' )    
                        if (isAnimated($_FILES['upload']['tmp_name']))
                                eval(print_standard_error('error_avataranimated'));
                if ( strlen($_POST['avatarurl']) && strtolower(substr($_POST['avatarurl'], -3)) == 'gif' )
                        if(isAnimated($_POST['avatarurl'], 1 && strtolower(substr($_POST['avatarurl'], -3)) == 'gif'))
                                eval(print_standard_error('error_avataranimated'));

// end
// Block Animated Avatars Hack - by Scha at freakforum.nu   
         
                if ($avatarid == 0)
                {
                        // begin custom avatar code


Add phrase 'avataranimated' under the category 'Front-End Error Messages' with the following content
Code:
We do not allow the usage of animated avatars on our forums. Please consider uploading a static image instead.

Done.


Please leave a comment if there is something you are wondering about, or if you encounter a bug.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 02-24-2005, 01:58 AM
kevin_r1 kevin_r1 is offline
 
Join Date: Oct 2002
Location: Tampa
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by nso
Polo: On my forums we value the information it contains above the package it is delivered in. Animated avatars steales focus from the content, and it is more intensive on 64K'ers since it in essense contains several images in one.
Then why do you allow avatars at all? Nice hack anyhow.
Reply With Quote
  #13  
Old 02-24-2005, 02:17 AM
Jolten Jolten is offline
 
Join Date: Mar 2004
Posts: 749
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FYI a 10k jpg takes up the same amount of space as a 10k animate gif.
Reply With Quote
  #14  
Old 02-24-2005, 06:32 AM
nso nso is offline
 
Join Date: Mar 2002
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sure, but a lot of forums allow crazyass filesize - mostly because the admins are too dumb to use the admcp
However the bandwidth has nothing to do with my descition to block animated avatars.

It is in my opinion, as earlier stated, screenspam which steales focus much more than a static 64x64 IMG (unless you do a goatse or something). My users love this rule, and there is never any complaints.
Reply With Quote
  #15  
Old 02-24-2005, 12:36 PM
Polo's Avatar
Polo Polo is offline
 
Join Date: Jun 2004
Posts: 893
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah... forums have different needs... every single forum is unique..
Reply With Quote
  #16  
Old 03-10-2005, 11:54 AM
nso nso is offline
 
Join Date: Mar 2002
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Updated the second profile.php edit and I suggest that anyone using this script update their profile.php with the changes. Just delete the old code and add the new.
Reply With Quote
  #17  
Old 03-21-2005, 03:29 AM
trulylowcarb's Avatar
trulylowcarb trulylowcarb is offline
 
Join Date: Apr 2004
Location: Colorado
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you VERY MUCH for this mod!!
Reply With Quote
  #18  
Old 04-01-2005, 12:56 PM
trulylowcarb's Avatar
trulylowcarb trulylowcarb is offline
 
Join Date: Apr 2004
Location: Colorado
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Note: having to uninstall this, as all avatar uploads stopped working. May have to do with the Geek Articles System 3.51 hack I installed afterwards? I will try installing it again and see what happens, but wanted to note this potential conflict.
Reply With Quote
  #19  
Old 04-01-2005, 03:32 PM
nso nso is offline
 
Join Date: Mar 2002
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please describe the actuall errors and/or errormessages you recieved and I might answer that for you.

Cheers.
Reply With Quote
  #20  
Old 04-01-2005, 03:35 PM
nexialys
Guest
 
Posts: n/a
Default

there is not a single link between the Geek articles system and this hack... btw, if your php server is older than 4.3, you may encounter the problem related to detecting image size and content...
Reply With Quote
  #21  
Old 04-01-2005, 03:37 PM
trulylowcarb's Avatar
trulylowcarb trulylowcarb is offline
 
Join Date: Apr 2004
Location: Colorado
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No errors, or at least no error messages at all ... the avatars appeared to save normally (regular files, not animated ones) but were not displayed/changed.
One user did report receiving the no animated images error message when trying to upload a static gif, but I couldn't reproduce that error myself. Sorry I can't be of more help.
*My php version is 4.3.10*

I'm sure it's probably just a conflict with another hack ...
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:38 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06832 seconds
  • Memory Usage 2,306KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete