MyBB Community Forums

Full Version: Forcing maximum signature dimensions for your users
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Many people like myself are annoyed by massive signatures and the character limit settings do little to prevent people from posting large images so here is an easy way to ensure your users signature aren't bigger than whats allowed by limiting the dimensions of the signature div.

First go ACP > Templates & Styles > Templates > Select Template > Post Bit templates > postbit and find the following code:
{$post['signature']}
then simply put a div tag with a limited height and hidden overflow like this:
<div style="height: 150px; overflow: hidden;">
	{$post['signature']}
</div>

Next go back to the template list and open the postbit_classic template and do the same, finding {$post['signature']} and enclosing it in a div just like the code above.

Thats it, your done! Anything bigger than 150px will simply be cut off and hidden!

Variations
To change the height limit you can simply change 150px to your own value, you can also change the width by adding width: 500px; after overflow: hidden;

The height property will always make the signature div that size so if you would prefer to allow any height up to the limit then you can substitute height with max-height, though I think some browsers have issues with this.

You can also put the CSS in the style sheet rather than inline by using this code instead:
<div class="sigdiv">
	{$post['signature']}
</div>
and adding the following to global.css:
.sigdiv{
height: 150px;
overflow: hidden;
}

Here is a print screen of the result:
[attachment=18292]
Thank you very much Toungue
Oooh very nice, Tim! Thanks for it. Smile
Will this cut text too?
Directly, I am using this on postbit_signature template
<div style="align:right; max-height: 100px; overflow:hidden">{$post['signature']}</div>

Confuse with max-height or height? Wink
http://www.w3schools.com/css/pr_dim_max-height.asp
http://www.css3.com/css-max-height/
(2010-05-14, 07:49 PM)faviouz Wrote: [ -> ]Will this cut text too?

Yes, it will essentially cut off everything beyond the specified height.

(2010-05-14, 11:29 PM)FBI Wrote: [ -> ]Confuse with max-height or height? Wink
I said in the variations section that you can use max-height but I'm pretty sure the max and min properties are not handled very well by some IE versions.
Nice, but personally I prefer resizing. Thanks anyway, might come in handy!
Thanks Tim.
Thanks Tim, you are having some real great tips Smile
This will be very useful, Thanks for the tutorial. Smile
Pages: 1 2