PDA

View Full Version : Stopping images in signatures from making the page really wide


UK Jimbo
01-10-2005, 10:00 PM
This is a hack we've used on visordown.com (http://www.visordown.com/forums/) in version 3.0.0 up to 3.0.5

It prevents users from having images in their sigs that push the width of the page larger than the template should be by adding some whitespace between each of the images.

You just need to edit one file includes/functions_showthread.php

On line 459 find:$post['signature'] = parse_bbcode($post['signature'], 'nonforum', $vboptions['allowsmilies']);

add on the line below it:$post['signature'] = preg_replace('/(<img[^<>]+>)(<img)/i',"\$1 \$2",$post['signature']);


The block of code should now look like: if (!isset($sigcache["$post[userid]"]))
{
$parsed_postcache['skip'] = true;
$post['signature'] = parse_bbcode($post['signature'], 'nonforum', $vboptions['allowsmilies']);
$post['signature'] = preg_replace('/(<img[^<>]+>)(<img)/i',"\$1 \$2",$post['signature']);
$sigcache["$post[userid]"] = $post['signature'];
}
else

boo.3
01-11-2005, 07:38 PM
screen shots?

what does it do with the rest of the image?

UK Jimbo
01-12-2005, 01:17 PM
screenshots added :)

cinq
01-12-2005, 01:29 PM
Those are some HUGE sigs :p

Soto
01-12-2005, 02:32 PM
What happens if it's a really wide single image - does it still display?

Is there a hack to limit the actual dimensions so that say, in admin panel you specify that a single sig image should not exceed 600 wide and 100 tall it would output a warning message rather than the image?

UK Jimbo
01-13-2005, 09:43 AM
Those are some HUGE sigs :p

That wasn't a real sig - I just dropped it in to demo this feature :)

UK Jimbo
01-13-2005, 09:56 AM
What happens if it's a really wide single image - does it still display?

Is there a hack to limit the actual dimensions so that say, in admin panel you specify that a single sig image should not exceed 600 wide and 100 tall it would output a warning message rather than the image?

Yup it will still display and push the width of the page out.

I've got a feeling that I've seen a hack which checks image dimensions but following a quick search I can't find it. Might be worth trawling the forum for it.

DES.deViant
01-23-2005, 03:03 AM
I don't understand what this hack does. When images are lined up horizontally in a post like that (in both Firefox and IE), it already automatically wraps them down to the next line when you have a small resolution or a huge row of images.

The single-image dimensions-checking hack sounds like a good idea though. That's what I was hoping this was.

UK Jimbo
01-23-2005, 03:29 PM
I don't understand what this hack does. When images are lined up horizontally in a post like that (in both Firefox and IE), it already automatically wraps them down to the next line when you have a small resolution or a huge row of images.

It does what it says on the tin :p

We certainly have the wrapping problem in sigs on our forum. Have a look at the screenshots.