![]() |
Sig image size control
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! [edit]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.[/edit] [edit]Update again, this fixes smooties prob's with it images being set to unlimited[/edit] |
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 :) |
np
|
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. :(
|
Nice work... haven't tested it but looks promising.
|
Quote:
|
Quote:
|
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.) :) |
Okay it works, it just doesn't work until the user has to changes their profile.
|
It only works for me if I change the setting above. Is there a way around that?
|
Quote:
|
Ah, ok. So this can be set to anything but 0 for it to work? Because at 0, it doesn't.
|
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: PHP Code:
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... |
Just so you know: instead of using this:
Code:
$max_height = $DB_site->query_first("SELECT value FROM setting where varname=\"maxsigheight\""); Anyway, I'll probably install this here later, looks good. |
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.
|
Well I installed this here, with some modifications, and it's working great. Great job Herman!
|
Quote:
|
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.
|
I will update the original file in a sec here.. and I'll post again with changes.
|
Just download the new update, and replace the whole size_check function in members.php with the new one.
|
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: Code:
find: Also, I reupdated the hack in the first post. |
Thanks FireFly :)
|
Firefly, would you mind posting the versiopn you installed with your modifications?
|
Excellent Herman! Thanks for the updates. :)
|
No problem! :)
|
What do you mean by submit? :)
Quote:
|
Goto Admin CP, goto Vbulletin Options, then goto the button and hit the submit button to save your options. Thats it! :)
|
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.
|
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?
|
Quote:
|
Ok... can someone post a query that deletes all sig files so I don't have to go in and manually delete each one?
|
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. |
Quote:
|
Code:
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. |
Herman, has there been any updates on the swf code for this hack?
|
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: Code:
// check max images Code:
$signature = preg_replace("/(\[)(swf)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/swf\])/seiU", "\swf_size_check('\\5','\\7')", $signature); Code:
?> Code:
function swf_size_check($image, $h_w) { Keep in mind, that this is NOT fully tested, but I wrote it b/c of requests. |
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.
|
i could really use this
|
|
All times are GMT. The time now is 04:43 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|