vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Better signature limiting options (https://vborg.vbsupport.ru/showthread.php?t=61239)

djwins 03-27-2005 01:59 AM

perfect timing...i just switched to VB today!

alexi 03-27-2005 05:35 PM

I can't wait to see this released...

Darmak 03-28-2005 04:40 AM

Quote:

Originally Posted by why-not
So what do you think, (1) or (2)

Option 2

Yep, yep =D :squareeyed:

kyzen 03-28-2005 06:49 AM

LOL, I just got this PM over at vbulletin.com:

Quote:

Originally Posted by Steve Machol
Could you please view the vBulletin Forum Rules about signatures and modify yours so it follows the posted rules:



Quote:

Signature Limits



All signatures should not exceed the following size limits, and you can't have both text and images

For text signatures: 4 lines normal size, 8 lines small size and up to 90 chars per line. Font sizes above 2 are not allowed. (Blank lines count as lines.)
For images in signatures: 1 image up to 300 pixels wide, 125 pixels tall and 20k in size
Animated images in sigs are not allowed
Thanks,

Steve

So I replied:

Quote:

Originally Posted by kyzen
Those rules are pretty cool and all... but if you guys would just hurry up and incorporate this https://vborg.vbsupport.ru/showthread.php?t=61239 then you wouldn't have to police it :) Just food for thought Steve ;)


msimplay 03-28-2005 07:51 AM

Quote:

Originally Posted by kyzen
LOL, I just got this PM over at vbulletin.com:
So I replied:

LOL what a way to get noticed :devious:

Julie 03-28-2005 12:48 PM

I've been looking for something like this myself, so a HUGE thanks to Sonia for coding this :) Can't wait to see this released either!

why-not 03-28-2005 03:49 PM

Hi Everyone...

Thanks for the input on the database question, I will use (2) as the way of doing the edit!

One other question!

image = height / width!

Lets say a image 200 pixles in width!

My question...

What should I use as a rule to convert ( number of pixels = 1 character)

What I mean...

Say a smilies is 15X15, height/width, and the font size is 10 pixles

So if I divided ( 15 / 10 ) then that smilie would = 1.5 characters!

So that is my question... (what should be the divider? 10 or maybe the size between the minimum and maximum allowed)!

I'll give you a idea of why I am asking!

After a signature has been validated, there is a chance that a line will have image(s) and text together....

Like so.....

this was a very sunny day [image]100X400[/image] and I enjoyed it very much! [image]100X400[/image]

The maximum line length is 120!

The example line above is ( 55 characters + ( 400/10 = 40) + (400/10 =40)

So it ends up being 135 characters, (15) over the limit, so if that happens, we do this!

reverse the string if we have more than one image, then line break it. The result!

this was a very sunny day [image]100X400[/image] and I enjoyed it very much!
[image]100X400[/image]


This way signatures never push the forum into a scroll view! Note this is a option that you can turn on or off...

Here is the function that does this!

Code:

/* this is only called to do line breaks on images with text (admin option) */

function sig_last_process ( $str, $uo )
{
        /* get each line */

        $lines = preg_split ( '#\r?\n#', $str );

        /* get the smilies they are waiting for us, static */

        $sc = sig_smilies ();

        /* the maximum line length */

        $line = $uo['line'];

        /* all the images in this signature in a nice array */

        $each = $uo['img'];

        /* loop de loop, easy stuff (lines loop) */

        for ( $i = 0; $i < sizeof ( $lines ); $i++ )
        {
                /* set are values, reset them for each line */

                $lc = 0;
                $it = 0;
                $hold = array ();
                $temp = $lines[$i];

                /* check if we find a image in this line */

                for ( $j = 0; $j < sizeof ( $each ); $j++ )
                {
                        if ( ( $is = substr_count ( $lines[$i], $each[$j][0] ) ) > 0 )
                        {
                                /* found a image convert from pixels to characters */

                                $it += ceil ( ( ( $is * $each[$j][2] ) / 10 ) );

                                /* remove the image and all of it's bbcode or html if it's on */

                                $temp = preg_replace ( '!\[.*' . $each[$j][0] . '\[\/.*\]|\<.*' . $each[$j][0] . '.*>!is', '', $temp );

                                /* load the remember array with this image. (used to do the line break loop) */

                                $hold[] = $each[$j][0];

                                /* loop the smilies and count them as we go */

                                for ( $k = 0; $k < sizeof ( $sc['text'] ); $k++ )
                                {
                                        if ( ( $ts = substr_count ( $temp, $sc['text'][$i] ) ) > 0 )
                                        {
                                                /* found a smile get it's height/width and convert it to total characters */

                                                // I am going to kill this, and just add the sizes to the smiliescache

                                                $ss = getimagesize ( './' . $sc['code'][$sc['text'][$i]][0] );

                                                $lc +=  ceil ( ( ( $ss[0] * $ts ) / 10 ) );

                                                /* remove this smilie so it does not count into the character count */

                                                $temp = sig_remove_smilie ( $temp, $sc['text'][$i] );

                                        }
                                }
                        }
                }

                /* done with this line, do we have a image? */

                if ( ! empty ( $it ) )
                {
                        /* we need to remove URL bbcode so it does not play into the character count */

                        $temp = preg_replace ( '!\[url=.*\]|\[\/url\]|\<a.*\>|\<\/a\>!is', '', $temp );

                        /* the total character in this line (images converted to characters, and real characters left in the line */

                        $total = ( strlen ( $temp ) + $it + $lc );

                        /* loop the line add the line break where it is needed */

                        if ( $total > $line )
                        {
                                for ( $l = 0; $l < sizeof ( $hold ); $l++ )
                                {
                                        $lines[$i] = preg_replace ( "!(\[.*" . $hold[$l] . "\[\/.*\]|\<.*" . $hold[$l] . ".*\<\/a\>)!is", "\r\n\\1", $lines[$i] );
                                }
                        }
                }
        }

        /* all done, give the signature back to the update user signature function */

        // another signature that passed the test, !!YA!!

        return ( implode ( "\r\n", $lines ) );
}


demo will finally be up tomorrow morning, beta release for sure sometime tomorrow!


Sonia

Protoman 03-28-2005 09:45 PM

sounds like you solved your own problem.

BPnet 03-31-2005 03:44 PM

Any chance of this being released soon? It looks like you just about got it nailed down several days ago. Thanks for coding this much-needed hack!

why-not 03-31-2005 08:13 PM

Quote:

Originally Posted by BPnet
Any chance of this being released soon? It looks like you just about got it nailed down several days ago. Thanks for coding this much-needed hack!

I final have the public demo up... (you can try it!)

http://forum.ya-right.com/index.php?

you need to create an account to demo the control, no validation needed!


I will be releasing it on Sunday, I just need to finish a few minor things (more phrases) for the extra stuff I added and the (help system / Forum Facts) needs to be updated to add the information for the new options!


I think I may have went a little over board, but total control you will have!!!


c, ya...

Sonia


All times are GMT. The time now is 12:42 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.01237 seconds
  • Memory Usage 1,766KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete