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)

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.


All times are GMT. The time now is 04:59 AM.

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.01075 seconds
  • Memory Usage 1,751KB
  • 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
  • (5)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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