View Full Version : Sig image size control
Herman
06-23-2002, 10:00 PM
I wrote this hack so i could obviously do what the title says.
When installed it you get an option in vb option of max height and width.
If a user's sig is too big, then when you look at their sig it'll say sorry this image is too large. And if the link doesn't work, then it'll say sorry that image doesn't exist. Thnx.. Don't forget to back up the databases!
This new one gets rid of the queries.. but, you have to submit your vbulletin options after installing the hack in order for it to work.
Update again, this fixes smooties prob's with it images being set to unlimited
Sinecure
06-24-2002, 04:10 AM
There seem to be a lot of signature limitation hacks :)
I'll install this on my test board. I want something simple, and not bloated with options, hopefully this does the job :)
Thanks :)
Herman
06-24-2002, 04:11 AM
np
Smoothie
06-24-2002, 05:06 AM
Followed instructions, set the limit in the vb options for sig width, height, added a test sig, bigger than the allowable limit, it still shows. :(
Admin
06-24-2002, 06:48 AM
Nice work... haven't tested it but looks promising.
Admin
06-24-2002, 06:49 AM
Originally posted by Smoothie
Followed instructions, set the limit in the vb options for sig width, height, added a test sig, bigger than the allowable limit, it still shows. :(
The hack doesn't work retroactively as far as I see.
Smoothie
06-24-2002, 06:56 AM
Originally posted by FireFly
The hack doesn't work retroactively as far as I see. I added a new sig after the hack, and it still shows.
Smoothie
06-24-2002, 07:50 AM
Ok, the one setting that needs to be changed for this to work is:
Under Posting Code allowances (vB code / HTML / etc):
Maximum images per post/signature: (This needs to be set to anything but zero.) :)
Herman
06-24-2002, 01:01 PM
Okay it works, it just doesn't work until the user has to changes their profile.
Smoothie
06-24-2002, 04:12 PM
It only works for me if I change the setting above. Is there a way around that?
Herman
06-24-2002, 05:12 PM
Ok, the one setting that needs to be changed for this to work is:
Under Posting Code allowances (vB code / HTML / etc):
Maximum images per post/signature: (This needs to be set to 1.)
Works just fine for me.. I have images set to 10 per post/sig, and It only kills the images that are too big.. For instance, if I have it set to 100x500, (default), and I add two images in my sig, one that is 320x240, and one that is 64x64, the 64x64 one stays, but the 320x240 one gets the message that its too big...
Smoothie
06-24-2002, 05:24 PM
Ah, ok. So this can be set to anything but 0 for it to work? Because at 0, it doesn't.
Herman
06-24-2002, 05:36 PM
Ok, here is how it works.
1. You update your profile
2. Before the BBCODE processor, a special function catches all img tags.
3. The function, called size_check, checks to see if the file exists, if it does, it gets the max size and width out of the configuration of your board, and checks to see if the image width is bigger first in width, then in height:
if ($im_width > $max_sig_width)
{
return "Sorry, image size exceeds maximum width of ".$max_sig_width.".";
}
if ($im_height > $max_sig_height)
{
return "Sorry, image size exceeds maximum height of ".$max_sig_height.".";
}
4. It returns the image in BBCODE notation if it is ok, otherwise, it returns the message shown above.
5. The bbcode processes it like normal!
I wasn't sure about your question about setting it to 0.. I wasn't sure what that was refering to...
Admin
06-24-2002, 05:38 PM
Just so you know: instead of using this:
$max_height = $DB_site->query_first("SELECT value FROM setting where varname=\"maxsigheight\"");
$max_width = $DB_site->query_first("SELECT value FROM setting where varname=\"maxsigwidth\"");
You can just use $maxsigwidth and $maxsigheight (globalize them in the function). BUT, you MUST Submit the vBulletin Options page in the Admin CP for this to work. :)
Anyway, I'll probably install this here later, looks good.
Herman
06-24-2002, 05:43 PM
Yea... I was trying to figure that out.. but every single time I tried to global those variables, it wouldn't work. They would return NULL. I didn't know you had to submit the vbulletin options again...lol. I'll edit the post and submit a revision.
Admin
06-24-2002, 05:52 PM
Well I installed this here, with some modifications, and it's working great. Great job Herman!
Smoothie
06-24-2002, 05:53 PM
I wasn't sure about your question about setting it to 0.. I wasn't sure what that was refering to...In my admin cp, i had maximum images/sigs per post set to zero. So, users could post unlimited images with img tag. But, the hack won't work with it set to zero. Anything but zero, and it works fine. That's what my post was about, and why I couldn't get it to work the first time. Now it works great. Will you be updating the original file with Firefly's changes, and if we have this installed, what needs to be changed?
Smoothie
06-24-2002, 05:58 PM
BTW, it would be really cool if you could control the amount of images in the signature, and in the posts separately. Like allow only one img tag in the sig, but a different amount in the posts.
Herman
06-24-2002, 05:58 PM
I will update the original file in a sec here.. and I'll post again with changes.
Herman
06-24-2002, 06:20 PM
Just download the new update, and replace the whole size_check function in members.php with the new one.
Herman
06-24-2002, 06:25 PM
Hmm.. Smoothie.. you are right .. it does not work if that setting is set to 0. I'll look into that.
[edit]S, to fix the problem with it being set to 0, when you did this part of the hack:
find:
// check max images
if ($maximages!=0) {
add:
$signature = preg_replace("/\[img\](\r\n|\r|\n)*((http|https):\/\/([^;<>\*\(\)\"".iif($allowdynimg,"","\?\&")."]+)|[a-z0-9\/\\\._\- ]+)\[\/img\]/seiU", "\size_check('\\2')", $signature);
add the code *BEFORE* the lines you had to find. that will fix it. sorry
Also, I reupdated the hack in the first post.
Herman
06-24-2002, 06:36 PM
Thanks FireFly :)
Robouk5
06-24-2002, 07:26 PM
Firefly, would you mind posting the versiopn you installed with your modifications?
Smoothie
06-24-2002, 08:54 PM
Excellent Herman! Thanks for the updates. :)
Herman
06-24-2002, 09:08 PM
No problem! :)
Boofo
06-24-2002, 09:09 PM
What do you mean by submit? :)
Originally posted by Herman
This new one gets rid of the queries.. but, you have to submit your vbulletin options after installing the hack in order for it to work.
Herman
06-25-2002, 08:08 PM
Goto Admin CP, goto Vbulletin Options, then goto the button and hit the submit button to save your options. Thats it! :)
LightBringer
06-27-2002, 03:04 AM
Is there anyway possible to limit flash movies within the signature as well?
Herman, in the admin-cp, the button you're referring to as "Submit" is called "Save Changes" in my vB, I think that's what's causing some confusion.
Darren Evans
06-27-2002, 07:09 PM
So, this hack won't work unless all my users update their bios? It won't work on the fly when the hack is installed?
Smoothie
06-27-2002, 07:19 PM
Originally posted by Darren Evans
So, this hack won't work unless all my users update their bios? It won't work on the fly when the hack is installed? That would be correct.
Darren Evans
06-27-2002, 08:23 PM
Ok... can someone post a query that deletes all sig files so I don't have to go in and manually delete each one?
Smoothie
06-27-2002, 08:29 PM
One thing you might try, turn off:
Allow vB IMG code in signatures in the admin cp, submit, then go back and turn it back on.
Darren Evans
06-27-2002, 08:59 PM
Originally posted by Smoothie
One thing you might try, turn off:
Allow vB IMG code in signatures in the admin cp, submit, then go back and turn it back on.
Nope. That didn't work. :( Thanks for the reply, though.
Herman
06-28-2002, 04:12 AM
update user set signature="";
and yes, it is possible to do it with Swf files, but I haven't written the code for that yet.
LightBringer
06-28-2002, 06:48 PM
Herman, has there been any updates on the swf code for this hack?
Herman
06-28-2002, 11:58 PM
Ok for SWF! Here it is.. I haven't completely put a lot of thought into this code b/c I was busy today, but it will do the job.
I designed this addition to be completely independant of the IMG sig control hack.. This hack addition will only affect swf's, so if you don't care about IMG and want swfs controled, only install this, however, you can install them both, and it wll control both.
find:
// check max images
if ($maximages!=0) {
add ABOVE
$signature = preg_replace("/(\[)(swf)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/swf\])/seiU", "\swf_size_check('\\5','\\7')", $signature);
find at the very end of the file:
?>
add ABOVE:
function swf_size_check($image, $h_w) {
global $maxsigheight, $maxsigwidth;
//parse_all img tags
$image_xy=@getimagesize($image);
if ($image_xy==NULL)
{
return "Image not found";
}
else {
//ok, here we need to see if the user specified a size(i believe the swf will
//default to default size if no height width is specified, so lets get the
//dimensions of the swf..
$im_width=$image_xy[0];
$im_height=$image_xy[1];
//ok, did the user specify a height? lets see...
unset($params);
$params=explode(" ", $h_w);
foreach($params AS $param)
{
if (preg_match("/(height)(=)(['\"]?)([^\"']*)(\\3)/siU", $param))
{
$im_height=preg_replace("/(height)(=)(['\"]?)([^\"']*)(\\3)/seiU", "\intval('\\4')", $param);
}
if (preg_match("/(width)(=)(['\"]?)([^\"']*)(\\3)/siU", $param))
{
$im_width=preg_replace("/(width)(=)(['\"]?)([^\"']*)(\\3)/seiU", "\intval('\\4')", $param);
}
}
if ($im_width > $maxsigwidth)
{
return "Sorry, swf size exceeds maximum width of ".$maxsigwidth.".";
}
if ($im_height > $maxsigheight)
{
return "Sorry, swf size exceeds maximum height of ".$maxsigheight.".";
}
}
return "" . $h_w . "";
}
Keep in mind, that this is NOT fully tested, but I wrote it b/c of requests.
Herman
06-29-2002, 12:01 AM
BTW, why does it parse the BBCODE in the [code] statements? This is very annoying.. In my above post, where the words appear italicized, there should be [i ] and [/i ] ending tags, for those interested.
DarkDraco07
06-29-2002, 02:40 AM
i could really use this
Kinox
06-29-2002, 04:58 AM
here is what i did
https://vborg.vbsupport.ru/attachment.php?s=&postid=266944
https://vborg.vbsupport.ru/showthread.php?s=&threadid=40402
ZiRu$
07-19-2002, 02:21 AM
thx man i installed it
Thunderpuck
08-08-2002, 05:04 PM
Excellent! I really needed this. Thanks!
:)
rstark
08-15-2002, 06:27 PM
I thought I had this working well, installed it and tested it. I have the max images per post/signature set to 20, I set the max image height to 200 and width to 500 and saved the changes in the options screen. I tested it with a 640x480 image and sure enough, it said I exceeded the width.
I just had a new user register today, and put in a signature of 224x464. The height exceeds my limit in the option yet his signature still show up. So for some reason, it's not checking the height but it checks the width. Can someone verify that if you upload a picture that only exceeds the height limit, that this hack will work? Thanks.
Oh yeah, I just double checked the code from the installation of this hack and everything matches up properly.
1freegaia
08-22-2002, 12:24 AM
Does it work with VB2.0.3 ?
thanks !
Herman
08-23-2002, 02:19 PM
rstark, your problem may be that the HTML code is enabled, that will make him able to get a larger signature than usual, so, disable that and it ends.... And it should work with any version of vB.
rstark
08-23-2002, 06:53 PM
Originally posted by Herman
rstark, your problem may be that the HTML code is enabled, that will make him able to get a larger signature than usual, so, disable that and it ends.... And it should work with any version of vB.
Well, I did have HTML code enabled, but I disabled it now. I looked at the user's signature and he is using the IMG tags and not html for the signature. Why would it only find the width of the signature in error but not the height? I've tried my own test on this.
Herman
09-08-2002, 03:17 PM
is he using it as like a .txt file off of angelfire? If so then that may be the prob.
rstark
09-08-2002, 08:55 PM
Originally posted by Herman
is he using it as like a .txt file off of angelfire? If so then that may be the prob.
No, his signature is plain text with the IMG codes.
Herman
09-12-2002, 03:57 PM
Hmm, then ask him how he's doing it, or email me with the actual code of it.
rstark
09-12-2002, 07:27 PM
Originally posted by Herman
Hmm, then ask him how he's doing it, or email me with the actual code of it.
I've tried my own test on this by creating an image that met the width requirement, but exceeded the height requirement and it allowed the image in the signature.
L-Mane
10-03-2002, 11:30 PM
I am trying to uninstall this query and I cannot do so.
$db1="INSERT INTO setting (settinggroupid, title, varname, value, description, optioncode, displayorder) values ('4', 'Max Sig Height', 'maxsigheight','100','Made specially for Otakuboards, Its our very own <B>SIG KILLER</B>! Yay!!', '', '10')";
$db2="INSERT INTO setting (settinggroupid, title, varname, value, description, optioncode, displayorder) values ('4', 'Max Sig Width', 'maxsigwidth','500','Made specially for Otakuboards, Its our very own <B>SIG KILLER</B>! Yay!!', '', '11')";
$DB_site->query($db1);
$DB_site->query($db2);
How can I do this?
Kinox
10-03-2002, 11:53 PM
$DB_site->query("ALTER TABLE setting DROP Max Sig Height");
$DB_site->query("ALTER TABLE setting DROP Max Sig Width");
S1R1US
12-08-2002, 08:15 PM
hey do you know if it works for version 3.0.0 of vbulletin?
Herman
12-14-2002, 10:22 PM
I'm not sure, I've never used vB3, how have u?
Colon33
12-22-2002, 07:59 AM
Does this also block people WHO link there sigs to other websites? or just images they upload themselves? I am assuming it goes for ANY image file located in the SIG. Right?
Herman
01-02-2003, 12:45 PM
Exactly
k4is3r
02-11-2003, 02:38 PM
This will work with Vb 2.2.9 ???
I've installed it, but i get always "image not found"!!!
Any suggestions???
tnx :classic:
Kriek
03-02-2003, 06:30 PM
Running into the same problem on 2.2.6.
Although it only seems to display Image not found when users update their profiles.
Herman
03-25-2003, 03:02 PM
It may be the way the show their sig, are they using HTML or the natural vB code?
k4is3r
03-25-2003, 03:38 PM
Today at 05:02 PM Herman said this in Post #59 (https://vborg.vbsupport.ru/showthread.php?postid=373089#post373089)
It may be the way the show their sig, are they using HTML or the natural vB code?
Natural vB coe :paranoid:
TYorke
04-09-2003, 06:35 AM
What's the latest on this? My users are also getting the "Image Not Found" message.
Also, I'm not sure if I saw wrong or not but, I think v2.3.0 already comes equipped with the Max Sig Height and Max Sig Width fields.
Boofo
04-09-2003, 02:50 PM
I'm not getting this to work at all. I have the image size set to 125 height and 450 width and I had a user upload an image that is 192 height and the image shows in his signature. Anyone have any ideas why this is happening? I am using 2.2.9, if it means anything.
k4is3r
04-09-2003, 04:19 PM
Today at 04:50 PM Boofo said this in Post #62 (https://vborg.vbsupport.ru/showthread.php?postid=379688#post379688)
I'm not getting this to work at all. I have the image size set to 125 height and 450 width and I had a user upload an image that is 192 height and the image shows in his signature. Anyone have any ideas why this is happening? I am using 2.2.9, if it means anything.
The same thing...... :( on vb 2.2.9
ryancooper
04-19-2003, 11:05 PM
Question.
OK i first set the max height to 60 and width to 100 to test.
TEsted and everythign works great, now I want to change the max height to 100 and width to 100 saved options and still get the error : Sorry, image size exceeds maximum height of 60.
I tried removing my sig, saving my profile then adding it again but it still is the same??
Nevermind I didn;t realize that it replaced the image with the text. :dead:
good hack :) installed with some slight modifications.
Boofo
04-30-2003, 04:06 PM
04-25-03 at 11:31 PM Jing said this in Post #65 (https://vborg.vbsupport.ru/showthread.php?postid=387242#post387242)
good hack :) installed with some slight modifications.
Could you share the modifications? I can't seem to get it to work right. ;)
k4is3r
05-04-2003, 04:43 PM
04-30-03 at 06:06 PM Boofo said this in Post #66 (https://vborg.vbsupport.ru/showthread.php?postid=389460#post389460)
Could you share the modifications? I can't seem to get it to work right. ;)
:cheeky:
Boofo
05-04-2003, 04:49 PM
My sentiments exactly. I'll just un-install it and find one that works. ;)
k4is3r
05-11-2003, 02:13 PM
05-04-03 at 06:49 PM Boofo said this in Post #68 (https://vborg.vbsupport.ru/showthread.php?postid=391272#post391272)
My sentiments exactly. I'll just un-install it and find one that works. ;)
Can you plz share the hack that finally works???
thank you in appreciate :classic:
Nitesh
05-22-2003, 09:05 PM
This hack works sometimes and other times it displays image not found.
Has anyone fixed this or have an alternative?
k4is3r
05-23-2003, 10:51 AM
Yesterday at 11:05 PM Nitesh said this in Post #70 (https://vborg.vbsupport.ru/showthread.php?postid=398649#post398649)
This hack works sometimes and other times it displays image not found.
Has anyone fixed this or have an alternative?
Boofo
05-23-2003, 12:22 PM
It seems that support has been dropped for this hack.
ZiRu$
06-11-2003, 02:27 PM
Thanks man I'm gonna re-install this
monstergamer
07-21-2003, 07:07 PM
works great
********installed********
Dez_U
04-08-2005, 06:20 PM
does thbis run on the latest version of VB?
thanks
Marco van Herwaarden
04-08-2005, 06:28 PM
No, this hack is written for vB2 and will probably not run on vB3.
Dez_U
04-08-2005, 06:32 PM
thanks Marco, just found one that looks cool
https://vborg.vbsupport.ru/showthread.php?t=79566&page=2&pp=15&highlight=signatures
:D
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.