Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

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
  #2  
Old 02-22-2005, 01:23 PM
yoyoyoyo's Avatar
yoyoyoyo yoyoyoyo is offline
 
Join Date: Dec 2004
Location: USA
Posts: 1,612
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

very cool!
Reply With Quote
  #3  
Old 02-22-2005, 02:46 PM
Polo's Avatar
Polo Polo is offline
 
Join Date: Jun 2004
Posts: 893
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what is wrong with animated avatars???

Well thanks for sharing anyways nso
Reply With Quote
  #4  
Old 02-22-2005, 03:24 PM
nso nso is offline
 
Join Date: Mar 2002
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 02-22-2005, 05:42 PM
Allan's Avatar
Allan Allan is offline
 
Join Date: Jun 2003
Location: France
Posts: 1,513
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Screenshot please ?
Reply With Quote
  #6  
Old 02-22-2005, 06:32 PM
Polo's Avatar
Polo Polo is offline
 
Join Date: Jun 2004
Posts: 893
Благодарил(а): 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.
yeah I know... i was just joking... i'm pretty sure that more than one person here at vbulletin.org will find your mod useful
Reply With Quote
  #7  
Old 02-22-2005, 07:47 PM
Jolten Jolten is offline
 
Join Date: Mar 2004
Posts: 749
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice.. but needs a usergroup conditional so certain usergroups can have animated avatars.
Reply With Quote
  #8  
Old 02-22-2005, 09:31 PM
Bolas's Avatar
Bolas Bolas is offline
 
Join Date: Jan 2003
Location: Venice
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Polo
what is wrong with animated avatars???

Well thanks for sharing anyways nso
From WCAG 1.0 (http://www.w3.org/TR/WAI-WEBCONTENT-...avoid-movement)

priority 2, WAI checkpoint 7.3 - "Do not create a blinking effect with animated gif images."

Some people with cognitive or visual disabilities are unable to read moving text quickly enough or at all. Movement can also cause such a distraction that the rest of the page becomes unreadable for people with cognitive disabilities. Screen readers are unable to read moving text. People with physical disabilities might not be able to move quickly or accurately enough to interact with moving objects.
Reply With Quote
  #9  
Old 02-22-2005, 10:10 PM
nso nso is offline
 
Join Date: Mar 2002
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Allan
Screenshot please ?
I don't think that's really needed here. The only visual effect of this script is a standard formated error message with a custom phrase when someone tries to upload an animated avatar.
Reply With Quote
  #10  
Old 02-23-2005, 03:47 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there a way to make this so Admins can have animated avatars but not anyone else? Might be a nice way to add a perk for certain membergorups on a site.
Reply With Quote
Reply

Thread Tools

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 11:53 AM.


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.05725 seconds
  • Memory Usage 2,294KB
  • Queries Executed 23 (?)
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
  • (3)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
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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