Forcing maximum signature dimensions for your users
#1
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:
   
Reply
#2
Thank you very much Toungue
I'm not here often, shoot a PM or whatever if you want my discord.
Reply
#3
Oooh very nice, Tim! Thanks for it. Smile
Reply
#4
Will this cut text too?
Reply
#5
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/
Hello, Welcome to MyBB Indonesia to get local support
My 'Simple' Unique Plugin here Smile
Reply
#6
(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.
Reply
#7
Nice, but personally I prefer resizing. Thanks anyway, might come in handy!
Reply
#8
Thanks Tim.
_______________________________________________

It is not disgraceful to ask, it is disgraceful no to ask.


sory for my english .
Reply
#9
Thanks Tim, you are having some real great tips Smile
Reply
#10
This will be very useful, Thanks for the tutorial. Smile
[Image: mygfxforumsadvertbanner.png]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)