Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Beta Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Quick Sig Image Size Limiter Details »»
Quick Sig Image Size Limiter
Version: 1.00, by phlogiston phlogiston is offline
Developer Last Online: Dec 2009 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 01-16-2004 Last Update: Never Installs: 34
Is in Beta Stage  
No support by the author.

A fairly quick and easy to install hack that attempts to check the pixel size of any images users place in their signatures. If the image is above admin set dimensions an error is given to the user explaining the valid dimensions.

I've not found a simple version of this for v3 - apologies if it's already out there somewhere!

- This is purely a BETA release as the getimagesize() function used seems to fail for certain images on one test install, unknown reason at present. This will not make the hack fail, simply some images on some servers will be allowed even if over the set size. To prevent this uncomment the five lines in the added code to give an invalid image message instead.


The options to set the size limits for signature images will be found in the admincp vBulletin Options --> User Profile Options


*****PLEASE NOTE*****
I am unable to provide any support at all for this hack - sometimes it works, sometimes it doesn't.
My knowledge dosn't reach far enough for me to understand or fix the reasons behind it failing on some installs, sorry.
If it works for you, I'm glad, if it doesn't then just revert everything and try looking at the other sig option hacks, sorry - best I can do

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #62  
Old 01-24-2005, 04:50 AM
BaconDelight BaconDelight is offline
 
Join Date: Jan 2005
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #63  
Old 01-25-2005, 07:47 AM
Jenta Jenta is offline
 
Join Date: Dec 2004
Posts: 377
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #64  
Old 01-25-2005, 09:09 PM
Jenta Jenta is offline
 
Join Date: Dec 2004
Posts: 377
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #65  
Old 01-27-2005, 02:44 PM
BaconDelight BaconDelight is offline
 
Join Date: Jan 2005
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #66  
Old 01-28-2005, 07:19 PM
???`S?LV?R???`'s Avatar
???`S?LV?R???` ???`S?LV?R???` is offline
 
Join Date: Aug 2003
Posts: 368
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #67  
Old 02-06-2005, 06:57 PM
Slybone Slybone is offline
 
Join Date: Sep 2003
Posts: 87
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #68  
Old 04-03-2005, 04:59 PM
illusions illusions is offline
 
Join Date: Feb 2005
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Reply With Quote
  #69  
Old 05-09-2005, 11:24 PM
womensden womensden is offline
 
Join Date: Jan 2005
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks, I really needed this.
Reply With Quote
  #70  
Old 06-01-2005, 08:57 PM
dfaonxa dfaonxa is offline
 
Join Date: Mar 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #71  
Old 06-02-2005, 05:31 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:21 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.04992 seconds
  • Memory Usage 2,316KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete