[vB3] Easily limit the size of user signatures

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chen
    Senior Member
    • Jun 2001
    • 8388

    [vB3] Easily limit the size of user signatures

    In the postbit template, or anywhere else a signature appears, replace this code:
    Code:
    $post[signature]
    With this:
    Code:
    <div style="width: [color=red]250px[/color]; height: [color=red]125px[/color]; overflow: hidden;">$post[signature]</div>
    The numbers in red signify the allowed width and height of the signatures, and you can change those values according to your forum rules.

    Using this method the browser will only show the "first" 250 pixels in width and 125 pixels in height, and the rest will be hidden. So even if your members use an image that is 1400 pixels wide and 1050 pixels high, they will be disappointed - not to mention p***ed off - to see that only a small portion of it is displayed.
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב
  • Rocol
    Senior Member
    • Nov 2002
    • 196
    • 3.6.x

    #2
    He, he, nice one Chen .. shall be using that

    Comment

    • Brian Briscoe

      #3
      Good idea Chen...

      Comment

      • Jenan
        Senior Member
        • Jun 2003
        • 196

        #4
        nice one
        is there any massage that will appear to user who try to put a signature over the limit?

        Comment

        • drews
          New Member
          • Nov 2002
          • 25

          #5
          Good mod, but is there a way where if the users signature is less than that width and height that it will shrink down? That way, if a user only has a one line signature it will not take up the entire 250x125px.

          Comment

          • Prince
            Senior Member
            • Sep 2001
            • 770
            • 4.2.5

            #6
            the only problem with that template mod, at least in vB 2.x.x, is all sigs will be set at that width/height even if their sig is not that big the space will be allocated for it in their posts which looks stupid IMO.

            Maybe not in vB3, I do not know.
            http://www.ironmagazine.com - blog
            http://www.ironmagazineforums.com - forums
            http://www.ironmaglabs.com - supplements

            Comment

            • drews
              New Member
              • Nov 2002
              • 25

              #7
              Thats exactly what I was saying.... there has to be a better way.....

              Comment

              • Prince
                Senior Member
                • Sep 2001
                • 770
                • 4.2.5

                #8
                well, you could add more code and create "scroll bars", but I think that looks tacky.
                http://www.ironmagazine.com - blog
                http://www.ironmagazineforums.com - forums
                http://www.ironmaglabs.com - supplements

                Comment

                • Prince
                  Senior Member
                  • Sep 2001
                  • 770
                  • 4.2.5

                  #9
                  this is how you could do it with scrollbars:

                  Replace $post[signature] with:

                  <div align="center" style="width:99%;height:200px;overflow:auto;"><normalfont>$post[signature]</normalfont></div>

                  but, personally I do no like how this looks either.
                  http://www.ironmagazine.com - blog
                  http://www.ironmagazineforums.com - forums
                  http://www.ironmaglabs.com - supplements

                  Comment

                  • gorman
                    Senior Member
                    • Sep 2002
                    • 178

                    #10
                    The problem is that IE does not support the max-height instruction, otherwise... there wouldn't be any problem

                    I've tried looking for a solution, and I've come up with this link:



                    Maybe somebody more HTML-savy than me will be able to come up with something good after reading it.

                    Comment

                    • gorman
                      Senior Member
                      • Sep 2002
                      • 178

                      #11
                      Code:
                       
                      <html>
                      <style>
                      body {
                      width:100%;
                      margin:0;
                      padding:0;}
                      p {
                      max-width:500px;
                      width:expression(document.body.clientWidth > 500? "500": "auto" );
                      }
                      </style>
                      <body>
                      <p>
                      $post[signature]</p>
                      </body>
                      </html>
                      This should limit the signature width to 500 pixels... the problem is that when I apply this, it gets applied to all the posts... I managed to limit the height and width (refer to the site I gave in the previous post), but never without causing problems to posts and so on... as I said, I'm not into HTML... at all...

                      As

                      Comment

                      • P.Jackson
                        Senior Member
                        • Dec 2002
                        • 425
                        • 3.8.x

                        #12
                        is there a way to limit signatures with text i.e 200 words?

                        Comment

                        • jilly
                          Senior Member
                          • Apr 2001
                          • 1235
                          • 3.7.x

                          #13
                          there's a character limit you can use..

                          There's not a 'word' limit, but I know for vB3 gamma there is a character limit for sig files you can use, and specify how many characters are allowed.

                          Comment

                          • gorman
                            Senior Member
                            • Sep 2002
                            • 178

                            #14
                            Nobody knows a way to apply the solution I found without having the posts affected?

                            Comment

                            • gorman
                              Senior Member
                              • Sep 2002
                              • 178

                              #15
                              With the help of the very kind Svend Tofte (http://www.svendtofte.com/), I managed to come up with the ultimate solution to this problem (or so it appears to me at the moment).

                              In template headinclude add this:

                              Code:
                               
                              <!-- signature control -->
                              <script>
                              function foo(elm) {
                              	if (elm.clientHeight >= 158) {
                              		return "158px";
                              	} else {
                              		return "default";
                              	}
                              }
                              </script>
                              <style type="text/css">
                              .signature {
                              	height:expression(foo(this));
                              max-height:158px;
                              }
                              <!-- end signature control -->
                              You have to remove the other <style type="text/css"> that appears just before the definitions for scrollbars color, etc.

                              And in postbit_signature substitute this:

                              Code:
                               <p><normalfont>__________________<br>
                              $post[signature]</normalfont></p>
                              with this:

                              Code:
                               
                              <p><normalfont>__________________<br>
                              <div style="width: 500px; overflow: hidden;" class="signature">$post[signature]</div></normalfont></p>
                              This sample code assumes the limit in place on my forums. 158 pixels for height and 500 pixels for width. The width remains fixed, as it's unlikely to cause problems. While the height limit adjust itself to take only the space needed until the limit you set.

                              I'm running 2.2.8 and it's working flawlessly so far.
                              Last edited by gorman; Thu 8 Jan '04, 7:49am.

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...