vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Signature Image Size Limiter (https://vborg.vbsupport.ru/showthread.php?t=83146)

Chris M 06-14-2005 10:00 PM

Signature Image Size Limiter
 
[high]Installation Instructions[/high]

Step 1: Upload the .xml file to the Product Manager
Step 2: Alter the plugin code variables to reflect your signature image limits in height and width
Step 2: Click [high]INSTALL[/high]:D

[high]Credits[/high]
Zero Tolerance - For helping with the regex and troubleshooting my annoying problems ;)

[high]Updates[/high]
1.0.1 - Nothing major, just removed some code that is not needed

To remove this without re-uploading the plugin, find in your plugin code:
PHP Code:

print_r($imginfo); 

and remove it - I put this in there for testing purposes and forgot to remove it :rolleyes:

1.0.2 - This is just a bug fix update ;)

Find in the plugin code:
PHP Code:

$this->registry->options['allowdynimg'

replace with:
PHP Code:

$vbulletin->options['allowdynimg'

As always, no need to upload the new plugin if you apply the fix directly to your plugin code ;)

Chris

M1th 06-15-2005 03:39 PM

Oh w00t. Me likey!

C.Birch 06-15-2005 04:43 PM

Error: See image.

Dan 06-15-2005 04:45 PM

I like this one Chris, good job!
/me clickies install

xxskullxx 06-16-2005 01:10 AM

Nice one! I'll definately be using this.

ThePimp 06-16-2005 04:51 AM

Doesn't seem to work for me.
Uploaded Plugin -> Added Error Phrase -> Set Size Limits -> Visited the board and the sigs that are large are still visible, with no error.

Trickyphillips 06-16-2005 05:17 AM

Quote:

Originally Posted by ThePimp
Doesn't seem to work for me.
Uploaded Plugin -> Added Error Phrase -> Set Size Limits -> Visited the board and the sigs that are large are still visible, with no error.

I believe it will only display the error, when a user is setting their signature. You'll have to use an SQL query to reset everyone's signature, and tell them that they need to change it back themselves. While they're setting it, the restrictions will apply.

Jagged Tooth 06-16-2005 05:24 AM

Quote:

Fatal error: Using $this when not in object context in C:\apachefriends\xampp\htdocs\forum\profile.php(11 70) : eval()'d code on line 23
I get that when i try to insert an image (even one small enough)

Chris M 06-16-2005 07:59 AM

Quote:

Originally Posted by Trickyphillips
I believe it will only display the error, when a user is setting their signature. You'll have to use an SQL query to reset everyone's signature, and tell them that they need to change it back themselves. While they're setting it, the restrictions will apply.

Indeed - You will need to clear the signature field and ask everyone to re-write their signatures ;)

Satan

Chris M 06-16-2005 07:59 AM

Quote:

Originally Posted by C.Birch
Error: See image.

Do you have Dynamic Image Urls enabled?

Satan

Robert Basil 06-16-2005 08:01 AM

Does this plugin limit the images in sigs using the [img] code or something else?

Chris M 06-16-2005 08:04 AM

Quote:

Originally Posted by Sportbikeworld
Does this plugin limit the images in sigs using the [img] code or something else?

This plugin searches for every instance of an [high][img][/high] tag and then extracts the url in between the tags...

It then checks the size of the image the user is trying to use, and if the size is bigger than allowed, displays an error message...

Satan

Trickyphillips 06-16-2005 08:16 AM

Quote:

Originally Posted by hellsatan
This plugin searches for every instance of an [high][img][/high] tag and then extracts the url in between the tags...

It then checks the size of the image the user is trying to use, and if the size is bigger than allowed, displays an error message...

Satan

Suggestion: Check for multiple images, and calculate the total height and width of the images combined. This would prevent users from using two images next to eachother as a single signature. :)

Zero Tolerance 06-16-2005 08:26 AM

Notice:

Please note that the image checker code is fully functional, and the code is correct, however bugs within the vBulletin Plugin/Hooks System is causing these errors, as it is removing slashes without adding them first, causing stuff like \ to disappear within our code.

However this bug is not consistant on all forums, so please be aware if you are getting errors, then it is the vB system itself, and not our code.

Thank you for reading,

- Zero Tolerance

Chris M 06-16-2005 08:32 AM

[high]Update[/high]
1.0.2 bug fix released :)

Replace (in the plugin code):
PHP Code:

$this->registry->options['allowdynimg'

with:
PHP Code:

$vbulletin->options['allowdynimg'

Or you can upload the new plugin attached to the first post ;)

Satan

C.Birch 06-16-2005 09:14 AM

Quote:

Originally Posted by hellsatan
Do you have Dynamic Image Urls enabled?

Satan


Yes i do.

Zero Tolerance 06-16-2005 09:19 AM

Quote:

Originally Posted by C.Birch
Yes i do.

Please read: https://vborg.vbsupport.ru/showpost....6&postcount=14

:)

- Zero Tolerance

C.Birch 06-16-2005 09:23 AM

ok, but i was just replying to something i had been asked. but if it was a vb bug would it not also do the same type of stuff with other plug in hacks im testing? or is it a random thing?

its ok, im just installing hacks on a test board to help people find and fix bugs.

Zero Tolerance 06-16-2005 11:22 AM

Depends what the plugins use, i found if you use the slash then it removes them, therefor in my plugins i do my best to avoid this, for now while the bug is present, hopefully it ill be fixed in beta 2 :)

- Zero Tolerance

MogKnight 06-16-2005 11:29 AM

does this just restrict size (as in KB) or also dimensions?

Chris M 06-16-2005 11:39 AM

Just dimensions...

A future release may contain size in KB limits, but since this current vB-related bug is preventing this plugin from functioning properly for some users, I'll leave this as it is until that is overcome :)

Satan

Martin 06-16-2005 07:41 PM

Awesome. I can't wait for the weighting to be added :)

chiptz 06-16-2005 09:26 PM

Hi,

Won't this increas server BW consumption, since this will make server to load every image every time a user's sig is shown?

Chris M 06-18-2005 11:31 AM

This only checks on the image when it is added to your signature - When viewing in threads or in PM's etc, the check is not initiated ;)

Satan

sandrose 06-19-2005 03:58 PM

Quote:

Originally Posted by hellsatan
This only checks on the image when it is added to your signature - When viewing in threads or in PM's etc, the check is not initiated ;)

Satan

Excellent Work. It is ready on my site: http://www.sandroses.com/abbs/

Chris M 06-19-2005 09:43 PM

For anyone wondering, it does not need to be updated to work with Beta 2 :)

Satan

Christine 06-25-2005 08:05 PM

Installed, tested and working flawlessly on Beta2.

:D

Chris M 06-26-2005 02:36 PM

Glad to hear it :)

Satan

Chris M 06-30-2005 08:08 PM

[high]Update[/high]
Beta 3: Update to confirm that this plugin works with vBulletin 3.5.0 Beta 3;)

Satan

The Keeper 07-06-2005 10:33 AM

Exactly where do you add an "Error Message" phrase? I've looked in the phrases manager and can't find any category for Error Messages to add the phrase into.

Chris M 07-06-2005 11:26 AM

Quote:

Originally Posted by The Keeper
Exactly where do you add an "Error Message" phrase? I've looked in the phrases manager and can't find any category for Error Messages to add the phrase into.

There should be a phrasegroup called "Error Messages" beneath or above (I forget) the "Front-end Redirect" phrasegroup...

If you upgraded from 3.0.x you may have it named as "Front-end Error Messages" as the upgrade didn't (not sure about the Beta 3 one :p) update the phrasegroup name ;)

Satan

Alrasam 07-07-2005 03:52 PM

Thank you:)

BuRNZau 07-08-2005 10:32 AM

Works great! thanks. :)

Oblivion Knight 07-10-2005 02:44 PM

Would it be possible to place the error in to vBulletin's $errors[] array in profile.php instead of printing the error in a separate standard_error page? I guess I'm a perfectionist, but I used to have it this way with 3.0.7 and I'm still struggling with the plugin system myself.. :(

Chris M 07-10-2005 03:51 PM

Quote:

Originally Posted by Oblivion Knight
Would it be possible to place the error in to vBulletin's $errors[] array in profile.php instead of printing the error in a separate standard_error page? I guess I'm a perfectionist, but I used to have it this way with 3.0.7 and I'm still struggling with the plugin system myself.. :(

It's worth a try :p

Try replacing, in the plugin:
PHP Code:

eval(standard_error(fetch_error('signaturetoobig'))); 

with:
PHP Code:

$vbulletin->GPC['preview'] = 'true';
$errors[] = fetch_error('signaturetoobig'$maxsigwidth$maxsigheight); 

Then alter your phrase to something like:
Quote:

Your signature image size is too large. The maximum dimensions are $maxsigwidth by $maxsigheight.
Dunno if it will work - Should do but I haven't had enough time to check out the fetch_error array or how it functions :p

Satan

Oblivion Knight 07-10-2005 05:21 PM

Unfortunately it didn't work, and was pretty close to what I'd tried already.. :)

This is the function fetch_error (in includes/functions.php):
Code:

// #############################################################################
/**
* Fetches an error phrase from the database and inserts values for its embedded variables
*
* @param        string        Varname of error phrase
* @param        mixed        Value of 1st variable
* @param        mixed        Value of 2nd variable
* @param        mixed        Value of Nth variable
*
* @return        string        The parsed phrase text
*/
function fetch_error()
{
        $args = func_get_args();

        // Allow an array of phrase and variables to be passed in as arg0 (for some internal functions)
        if (is_array($args[0]))
        {
                $args = $args[0];
        }

        if (!function_exists('fetch_phrase'))
        {
                require_once(DIR . '/includes/functions_misc.php');
        }

        $args[0] = fetch_phrase($args[0], PHRASETYPEID_ERROR, '', false);

        if (sizeof($args) > 1)
        {
                return call_user_func_array('construct_phrase', $args);
        }
        else
        {
                return $args[0];
        }
}

This is the function of the array, $errors (in profile.php):
Code:

                if (is_array($errors))
                {
                        $errorlist = '';
                        foreach ($errors AS $key => $errormessage)
                        {
                                eval('$errorlist .= "' . fetch_template('newpost_errormessage') . '";');
                        }
                        $show['errors'] = true;
                }

I could easily do it editing the source file, but I'd like to try and get my head around this darned Plugin system with hooks.. Hopefully I'm not the only one struggling with it? :nervous:

Chris M 07-10-2005 05:40 PM

Quote:

Originally Posted by Oblivion Knight
Unfortunately it didn't work, and was pretty close to what I'd tried already.. :)

This is the function fetch_error (in includes/functions.php):
Code:

// #############################################################################
/**
* Fetches an error phrase from the database and inserts values for its embedded variables
*
* @param        string        Varname of error phrase
* @param        mixed        Value of 1st variable
* @param        mixed        Value of 2nd variable
* @param        mixed        Value of Nth variable
*
* @return        string        The parsed phrase text
*/
function fetch_error()
{
        $args = func_get_args();

        // Allow an array of phrase and variables to be passed in as arg0 (for some internal functions)
        if (is_array($args[0]))
        {
                $args = $args[0];
        }

        if (!function_exists('fetch_phrase'))
        {
                require_once(DIR . '/includes/functions_misc.php');
        }

        $args[0] = fetch_phrase($args[0], PHRASETYPEID_ERROR, '', false);

        if (sizeof($args) > 1)
        {
                return call_user_func_array('construct_phrase', $args);
        }
        else
        {
                return $args[0];
        }
}

This is the function of the array, $errors (in profile.php):
Code:

                if (is_array($errors))
                {
                        $errorlist = '';
                        foreach ($errors AS $key => $errormessage)
                        {
                                eval('$errorlist .= "' . fetch_template('newpost_errormessage') . '";');
                        }
                        $show['errors'] = true;
                }

I could easily do it editing the source file, but I'd like to try and get my head around this darned Plugin system with hooks.. Hopefully I'm not the only one struggling with it? :nervous:

Yes with the source code it should be easy to modify, and in theory it should work with the plugin :ermm:

Satan

jesus likes pie 07-10-2005 09:00 PM

this is an ownage hack defianed


[high]* jesus likes pie clicks installed
[/high]


......hey....the /me hack works and we're runnign beta 3! ERWIN HOW DO I GET /ME FOR MY BETA?! :(

Chris M 07-10-2005 10:40 PM

vBulletin.org is running on of the 3.0.x releases, not a 3.5.0 Alpha, Beta, Gamma, RC or Gold release :)

Satan

yinyang 07-12-2005 01:27 AM

* installs * great work ... hmmm, have you met your nemesis, heavengod?


All times are GMT. The time now is 04:50 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.01474 seconds
  • Memory Usage 1,849KB
  • 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
  • (4)bbcode_code_printable
  • (7)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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