MyBB Community Forums

Full Version: [TUTORIAL] Adding Easy-To-Configure Signature Image Size Limits to The Thread View
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Quick Description: Hello everyone. I am here to show you a little tutorial on how to implement an easy-to-use and configure system, which allows you to define maximum signature image widths and heights. This only affects the post view (not profiles or anything else) but it can be easily adapted to do so.

MyBB Version: 1.4.x Series

The Tutorial:

First off, log into your Administrative Control Panel (Admin CP) and navigate to the Configuration -> Board Settings area. Click on Add New Setting, and add the following information...

Quote:Title: Maximum Signature Image Width
Description: Use this setting to define the maximum WIDTH for displaying images in signatures.
Group: Show Thread Options
Identifier: max_sig_w
Type: Text

And click Add New Setting. Now you must add another setting; click Add New Setting again, and input these values:

Quote:Title: Maximum Signature Image Height
Description: Use this setting to define the maximum HEIGHT for displaying images in signatures.
Group: Show Thread Options
Identifier: max_sig_h
Type: Text

Then click Add New Setting.

Next, navigate to your Templates & Styles section. Go to Templates, and open up your theme's templates. Go to the Post Bit Templates, open up the postbit template and find:
{$post['signature']}

... and replace with:
<style type="text/css">
.signature img {
max-height: {$mybb->settings['max_sig_h']}px;
max-width: {$mybb->settings['max_sig_w']}px;
}
</style>
<div class="signature">
{$post['signature']}
</div>

Save your template(s) and do the EXACT SAME EDIT FOR THE postbit_classic template.

Once your template edits are complete, return to your settings (Show Thread Options) and configure your image settings (they should be near/at the top). If a signature image hits either of the limits, their image will only show at that size.

Have fun!
nice tutorial. Works in Firefox and the others "decent" browsers Smile

but I donĀ“t think IE handle these CSS properly, maybe you want to put an observation in your tut. about this
Maybe IE6, but IE7 supports it. I'm not going to get into IE6 though.
That will only change the display of the image and not the actual size itself.
Scoutie44 Wrote:This only affects the post view
??
very good
Thanks! I was looking for this!
Hmm, may become useful in the future.
How do I set it to resize the posted images?
Nice tutorial. Thanks for posting it.
Pages: 1 2