Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
Dynamic Picture Resize for [IMG] tag Details »»
Dynamic Picture Resize for [IMG] tag
Version: 1.0.1, by TECK TECK is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: Show Thread Enhancements - Version: 3.6.8 Rating:
Released: 09-06-2007 Last Update: 09-07-2007 Installs: 165
Uses Plugins
Code Changes  
No support by the author.

If an image submited by a user (using the [IMG] bbcode tag) is to big, chances are that it will break your current vBulletin style. This hack will dynamically resize that image to acceptable dimensions, that you previously specified. It will do it for pictures inserted into postbit or user signature.

The code modifications listed below were tested into a clean installed vBulletin board. They work 100%.

Installation
In order to perform an efficient modification of your files, I recommend you to use Komodo Edit or Textpad.
Both editors will allow you to complete all steps without any coding errors.

You will need to make one small change for each of the following files:

? vbulletin_global.js (folder /clientscript)
? class_bbcode.php (folder /includes)


Make sure you modify, save and upload one file at the time to your server.
Then, simply run the product-dynamicpic.xml file.

Once the product installed, don't forget to enable it.
Go to your vBulletin Options, click on Dynamic Picture Resize setting group and set all your options.
If you encounter any problems, feel free to post in the support thread.

Learn how to open the image into a new tab/window.
But you should stop using the target tag, since it will be deprecated soon.
There is a reason why all browsers have now the Shift and CTRL options to open a new tab/window with the link you click on.

Show Your Support

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

Comments
  #42  
Old 09-08-2007, 03:00 PM
thincom2000 thincom2000 is offline
 
Join Date: May 2006
Location: Bronx, NY
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TECK View Post
You are person no. 2 who requested the above feature.
Keep in mind this: There is no way (for now) to separate the [IMG] bbcode from actual postbit and signature. In other words, if you have a message because the image is resized, this message will show anywhere, including the signature, which will make users upset.

I will definitely not edit the code in several vBulletin files, just to avoid this feature in the signature... so be aware what you ask for.
Actually, there is a way. When $bbcode->parse() is called, the parser checks whether we are in the calendar, a pm, signature, etc (stored in $forumid). Directly afterwards the bbcode_parse_start hook is called, which you can in turn use to store this info in a way that can be passed to your function.

Also, check out $bbcode->do_parse() and the other subsequently called functions, because it is entirely possible to accomplish this mod without using any file edits (which I'm sure everyone would like). I'll install it such on my site and post the code when I am done.
Reply With Quote
  #43  
Old 09-08-2007, 03:34 PM
xandizitxu xandizitxu is offline
 
Join Date: Mar 2005
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Got it to work sorry! Forgot just to set the vBulletin Options!


Quote:
Originally Posted by thincom2000 View Post
Actually, there is a way. When $bbcode->parse() is called, the parser checks whether we are in the calendar, a pm, signature, etc (stored in $forumid). Directly afterwards the bbcode_parse_start hook is called, which you can in turn use to store this info in a way that can be passed to your function.

Also, check out $bbcode->do_parse() and the other subsequently called functions, because it is entirely possible to accomplish this mod without using any file edits (which I'm sure everyone would like). I'll install it such on my site and post the code when I am done.
That is what I'am looking for!
Reply With Quote
  #44  
Old 09-08-2007, 04:39 PM
we_scooter we_scooter is offline
 
Join Date: Aug 2002
Location: KSA
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default



I am a fan since HOMELITE for VB2
Definistely INSTALLED thanx TECK
miss TECKWIZARD.com
Reply With Quote
  #45  
Old 09-08-2007, 04:42 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by thincom2000 View Post
Actually, there is a way. I'll install it such on my site and post the code when I am done.
Glad to see the hackers are still sharing their knowledge.

Personally, I will never use this approach. Inserting the code directly is way faster then using it on a hook. Plus, you will need to use all kind of preg_replaces in order to isolate the link.
I never understood why the hook obsession, they actually slow your server... a lot. Who cares if you edit the file and add a small piece of code.

I challenge you to show me a better and faster way, compared to the code I made.
If you win, I pay the beer...
Reply With Quote
  #46  
Old 09-08-2007, 04:43 PM
thincom2000 thincom2000 is offline
 
Join Date: May 2006
Location: Bronx, NY
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, here are the updates:
  • eliminated all file & CSS edits
  • added vBulletin Option to open in new window
  • added vBulletin Option for a "this image has been resized" message

In total, there may be 1 additional preg_replace, because the plugins bypass the original IMG bbcode handler. And the template is not eval'd on its own, keeping speed in mind.

Changes to the product file:
  • Added 3 plugins
  • Added 1 template (scroll to bottom for CSS)
  • Added 2 settings

Quote:
Originally Posted by TECK View Post
I never understood why the hook obsession, they actually slow your server... a lot.
This is why my site only has one plugin for each hook, with one line of code each. This include()s plugins saved in the file system. I think I halved load times by spending a week doing that.
Reply With Quote
  #47  
Old 09-08-2007, 04:44 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by we_scooter View Post
miss TECKWIZARD.com
Something really big is coming... in few months.
A new teckwizards site will evolve... be prepared.
Reply With Quote
  #48  
Old 09-08-2007, 04:51 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by thincom2000 View Post
Okay, here are the updates ...
I win! You replaced my 4 lines of code with 285 execution processes.
However this is a very good solution, for people who don't want to edit their files.

Now, pay the beer! I'm in Montreal.
Reply With Quote
  #49  
Old 09-08-2007, 04:56 PM
PixelFx PixelFx is offline
 
Join Date: Dec 2002
Posts: 1,117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey tech long time no chat , nice hack got a client been looking for something like this for his blog
Reply With Quote
  #50  
Old 09-08-2007, 06:48 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by thincom2000 View Post
This is why my site only has one plugin for each hook, with one line of code each. This include()s plugins saved in the file system. I think I halved load times by spending a week doing that.
Good call, I like your thinking. That is exactly what I do also... Lizard King can confirm how many times I insisted on this matter, for his site.
I suggested that to vBulletin team also, for their products. In Project Tools and Blog I replaced all their hook code with files.

While doing some benchmarks to emulate 10,000 users hitting a server, the results were shockingly better, compared to the code left in hooks.

Quote:
Originally Posted by PixelFx View Post
Hey tech long time no chat , nice hack got a client been looking for something like this for his blog
Glad I could help, Robert.
Reply With Quote
  #51  
Old 09-08-2007, 10:19 PM
pspmaster93 pspmaster93 is offline
 
Join Date: Aug 2007
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can you include a readme guide for updating from the previous version?
Reply With Quote
Reply

Thread Tools

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 11:43 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05457 seconds
  • Memory Usage 2,320KB
  • 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
  • (8)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
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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