Announcement

Collapse
No announcement yet.

[vB3] Easily limit the size of user signatures

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [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: 250px; height: 125px; 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 הרשת ע"י מעריב

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

    Comment


    • #3
      Good idea Chen...

      Comment


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

        Comment


        • #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


          • #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


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

              Comment


              • #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


                • #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


                  • #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:

                    http://www.svendtofte.com/code/max_width_in_ie/

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

                    Comment


                    • #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


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

                        Comment


                        • #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


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

                            Comment


                            • #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 8th Jan '04, 7:49am.

                              Comment

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