vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=34)
-   -   Quick Sig Image Size Limiter (https://vborg.vbsupport.ru/showthread.php?t=60354)

Boofo 05-19-2004 02:22 AM

Ouch! Thank you, anyway. ;)

Boofo 05-19-2004 02:32 AM

Someone forgot to make the query for this:

Quote:

sig_image_too_many = The maximum number of images allowed is $vboptions[sigmaximages].

ImportPassion 05-22-2004 12:07 AM

i would really really like to see the weight check included in here.

ImportPassion 05-22-2004 02:10 AM

ok, i did it myself.

the weight check has been imlplemented.

Acido 05-30-2004 06:55 AM

Quote:

Originally Posted by 7thgenCivic.Com
ok, i did it myself.

the weight check has been imlplemented.

The only thing that it hack needs to be perfect, is limit LINES in signatures. :)

alsakher 05-30-2004 10:08 AM



Nice hack, but it is very important to limit the number of images allowed in the signiture, otherwise, this hack will be useless !!

Prince 06-01-2004 03:15 AM

this has nothing to do with this hack, but here is an alternative sig "limiter", one simple template edit:

postbit:
<div align="left" style="width:99%;height:125px;overflow:auto;"><nor malfont>$post[signature]</normalfont></div>

dniMTheory 06-07-2004 02:37 AM

Can all the addons and changes please be compiled into one install file and updated for the the latest version of VB.

n00belit3 06-07-2004 03:37 AM

Quote:

Originally Posted by Prince
this has nothing to do with this hack, but here is an alternative sig "limiter", one simple template edit:

postbit:
<div align="left" style="width:99%;height:125px;overflow:auto;"><nor malfont>$post[signature]</normalfont></div>

ownt?

n00belit3 06-07-2004 03:39 AM

How coud i modify this to make it work for images in a post not just in a sig?

Christine 06-19-2004 04:33 PM

I just found a problem with this. If sig limits are on (example 400 characters) and the sig is text only, then the system adheres to the 400 character limit. If there are images in the signature, than it ignores the limit, and allows sigs of any length to be posted, so by adding a single image to the sig, the member can override the character limit function.

Anyone have any ideas on this one?

Code Monkey 08-01-2004 05:10 AM

Hmm, I installed this in 3.03 and it didn't do anything. :(

tHe Rk 08-24-2004 12:20 AM

Works perfect in 3.0.1 :)

tHe Rk 08-24-2004 07:58 PM

Quote:

Originally Posted by JumpD
Hmm, I installed this in 3.03 and it didn't do anything. :(

Did you run the Queries? Because it's not like you replace any code for this, its simply added code, so I would think it should work with every version, which leads me to believe you didn't do the queries. :ermm:

Quote:

Originally Posted by Christine
I just found a problem with this. If sig limits are on (example 400 characters) and the sig is text only, then the system adheres to the 400 character limit. If there are images in the signature, than it ignores the limit, and allows sigs of any length to be posted, so by adding a single image to the sig, the member can override the character limit function.

Anyone have any ideas on this one?

I didn't have that problem. The character limit was still working for me.

gwhooooey 09-29-2004 01:03 AM

Any way to make it so the images auto-resize if they're too big?

Ymeaga1n 10-26-2004 10:02 PM

I have a question about this hack, say I upload the file 123.jpg and use it as my sig. Your hack approves it becaues it is under the max size. After the image is displayed, I make a larger image and reupload it with same name overwritting 123.jpg. Correct me if I'm wrong but if only the UserCP can check the size again there is no way to limit someone from overwriting the file.

dfaonxa 11-11-2004 08:07 PM

Alright, a couple of problems... I uploaded the hack to 3.03, if I try to upload a sig that's too big it gives me the error, but it didn't make any changes to the existing sigs that are too big. Any thoughts on why this is, what I can fix, or what a workaround is so I can get all my users to go change their sigs?

Also, when installing 7thgenCivic.Com's weight limit hack, I was returned the following error when I clicked on Edit Signature:

Quote:

Parse error: parse error, unexpected T_IF in /home/file/public_html/bb/profile.php on line 1339
Which is the line:

Quote:

if (!$image_size[2])
Any suggestions? Thanks!

ImportPassion 11-11-2004 11:05 PM

i thinku got some messed up code somewhere. only thing i can suggest as it does work.

btw: only way to make all users comply is to delete everyones sig and make then start over.

BaconDelight 01-24-2005 03:49 AM

Hi, quick help with this. I attempted to install this hack (my first hack) on a test board. I ran all the queries, added all the phrases, and added the code into profile.php, making sure to use the corrected and updated code, including the image weight option. The admincp options showed up, however, now signatures do not show up in threads at all. I noticed this while checking to see what affect installing the hack would have on an existing sig image that's too big, so I did not check to see if the hack actually limited the size of new sigs. Once I noticed that sigs were't showing up, the very next thing I did was replace the modified profile.php with the backup I made. But even after doing this, sigs still don't show up. What's going on?

Edit: Hmm, upon further testing, it seems that it might be working correctly afterall. I think it was a matter of one signature having an image that's too large, and anothe ID that didn't have a signature to begin with.

But it seems I'm having the same issue as dfaonxa above. If I install the image weight code, going into "Edit Signature" returns an error.

BaconDelight 01-24-2005 04:08 AM

Oops, where's the :slap forehead: smiley? Misread of the image weight mod, didn't notice that where it says,

Code:

find

                                if (!$image_size[2])
                                {
                                        eval('$errors[] = "' . fetch_phrase('attachnotimage', PHRASETYPEID_ERROR) . '";');
                                        $preview = 'true';
                                }

that the "find" isn't code, but an instruction. It's all clear now. Well, just ignore me, unless you're dfaonxa, in which case, hopefully this will help you solve your issue. :)

BaconDelight 01-24-2005 04:50 AM

Should I be worried that talking to myself is solving all my problems?

So anyway, I got it installed, everything seemed to be working, except the weight limit function didn't seem to be catching things correctly. I left it set at the 35840 bytes that the query given in the mod has. I then attempted to load a sig pic that is about 218kB....and it let me. That seemed odd. So after a bunch of experimenting, I discovered that the remote_file_size function is returning value that's off by a factor of exactly 10. So it thinks my image (which is 223,554 bytes) is only 22,355 bytes (so the actual size, divided by 10). In another test, an image of size 134,154 was only blocked once the limit was set to 13,415 or below.

Combing through the function, nothing is jumping out to my untrained eye, but something is definitely wrong. For now, I'm just going to use the work around of changing if (remote_file_size($checkimage) > $vboptions['sigmaxweight']) to if (remote_file_size($checkimage)*10 > $vboptions['sigmaxweight']). I've tested this, and it works. But if anyone would like to debug the function and see where it's losing this factor of 10, be my guest.

Jenta 01-25-2005 07:47 AM

Quote:

Originally Posted by Prince
this has nothing to do with this hack, but here is an alternative sig "limiter", one simple template edit:

postbit:
<div align="left" style="width:99%;height:125px;overflow:auto;"><nor malfont>$post[signature]</normalfont></div>

I love this simplistic approach and am using it for dimensions
The only problem is it ALWAYS makes the signature area that big. Even if its just a couple of words.

Probably impossible but any way to do some sort of if statement to check if the signature contains an image?

Jenta 01-25-2005 09:09 PM

I've figured out a solution

disable [img] tags in signatures
create a new bb code called sig

Title: Signature Image
Tag: sig
Replacement: <div style="width:500px;height:140px;overflow:hidden;"> <img src="{param}"></div> (change this as you see fit)
Example: [sig]http://www.yoursite.net/samplesig.gif[/sig]
Description:This is similar to the [img] tag but is used for signatures only.

This way only images take up the full space. If someone has a smiley or a short piece of text it wont make the signature area bigger than it needs to be.

BaconDelight 01-27-2005 02:44 PM

I've modified the hack so that smilies do not count against the limit of number of images in the signature. The way I did it was quick and dirty, I'm sure there's a more elegant solution, but this works and entails just adding one line and modifying one other. I'm still a php novice, so I went with what works. If someone wants to clean it up, be my guest. My solution has 2 steps:

1) In the Quick Sig Image Size Limiter code, find the conditional:

Code:

if( count($sigimages[2]) > $vboptions['sigmaximages'] )
Modify that to:

Code:

if( (count($sigimages[2])- fetch_character_count($parsedsig, '<img src="http://[your domain]/[your board's root directory]/images/smilies/"'))> $vboptions['sigmaximages'] )
Make sure you replace [your domain] and [your board's root directory] with the proper values for your board.

2) Directly above the line you just modified, add:

Code:

require_once('./includes/functions_misc.php');
You're done. Like I said, I'm sure this isn't the cleanest solution. Basically I just noticed a bit of existing code that uses a function call to parse the signature and check it agains the global post image limit. I used that and modified it to find images in the sig that are located in the smilie directory and subtracted it from the total images in the sig.

???`S?LV?R???` 01-28-2005 07:19 PM

Quote:

Originally Posted by utlamer
I've figured out a solution

disable [img] tags in signatures
create a new bb code called sig

Title: Signature Image
Tag: sig
Replacement: <div style="width:500px;height:140px;overflow:hidden;"> <img src="{param}"></div> (change this as you see fit)
Example: [sig]http://www.yoursite.net/samplesig.gif[/sig]
Description:This is similar to the [img] tag but is used for signatures only.

This way only images take up the full space. If someone has a smiley or a short piece of text it wont make the signature area bigger than it needs to be.

then people can post that sig bb code all over the forum, flooding it with images.

Slybone 02-06-2005 06:57 PM

Code:

vBulletin Message
An error occurred while attempting to execute your query. The following information was returned.
error number: 1064
error desc: You have an error in your SQL syntax near ';
INSERT INTO `setting` (varname, value, optioncode, displayorder, grouptitle,' at line 1

this is what happened when i tried to run
Code:

        INSERT INTO `setting` (varname, value, optioncode, displayorder, grouptitle, defaultvalue, advanced, volatile) VALUES ('sigmaxheight', '150', '', 141, 'user', '480', 0, 0);
        INSERT INTO `setting` (varname, value, optioncode, displayorder, grouptitle, defaultvalue, advanced, volatile) VALUES ('sigmaxwidth', '400', '', 142, 'user', '640', 0, 0);

*EDIT* this is me being stupid... didnt notice I could only run one at a time :-P

illusions 04-03-2005 04:59 PM

Okay i must be doing something wrong... because i followed the instruction to the T ...and its still not working.. meaning it allows me to add limitation to the size height n width..but does not validate it..when members go beyond the size of 500 X 125 ?? why?.. i must be doing something wrong...its still allowing members to have large images in their signitures... :ermm:

womensden 05-09-2005 11:24 PM

thanks, I really needed this.

dfaonxa 06-01-2005 08:57 PM

Alright, I'm trying to re-implement this hack on 3.0.7, and when I try to run the first query

Quote:

INSERT INTO `setting` (varname, value, optioncode, displayorder, grouptitle, defaultvalue, advanced, volatile) VALUES ('sigmaxheight', '150', '', 141, 'user', '480', 0, 0);
it returns the following error:

Quote:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1062
error desc: Duplicate entry 'sigmaxheight' for key 1
Help? :nervous: Thanks!

Marco van Herwaarden 06-02-2005 05:31 AM

IF you have installed it on a previous version of vB, you will probably only have to redo the file edits. You are now trying to insert a value into the database that already exit.

MPDev 06-06-2005 12:24 PM

Anyone tried to use the same code to scan the current signatures and remove any img tags which exceed the limits?


All times are GMT. The time now is 10:15 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
  • Page Generation 0.01775 seconds
  • Memory Usage 1,819KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (31)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete