No announcement yet.

[vB3] Easily limit the size of user signatures

  • 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:
    With this:
    <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


    • #3
      Good idea Chen...


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


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


          • #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.
   - blog
   - forums
   - supplements


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


              • #8
                well, you could add more code and create "scroll bars", but I think that looks tacky.
       - blog
       - forums
       - supplements


                • #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.
         - blog
         - forums
         - supplements


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


                    • #11
                      body {
                      p {
                      width:expression(document.body.clientWidth > 500? "500": "auto" );
                      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...



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


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


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


                            • #15
                              With the help of the very kind Svend Tofte (, 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:

                              <!-- signature control -->
                              function foo(elm) {
                              	if (elm.clientHeight >= 158) {
                              		return "158px";
                              	} else {
                              		return "default";
                              <style type="text/css">
                              .signature {
                              <!-- 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:

                              with this:

                              <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.


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