Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons
FAQ Community Calendar Today's Posts Search

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
  #52  
Old 09-08-2007, 10:38 PM
xandizitxu xandizitxu is offline
 
Join Date: Mar 2005
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by thincom2000 View Post
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



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.
Okay I installed your product xml, uninstalled the other and now I get this

Quote:
<div><div class="resizednote">This image has been resized for improved display.</div><img src="http://img249.imageshack.us/img249/7245/bscap 0015fb3.jpg" border="0" alt="" class="resizeimage" onload="resize_image(this, 'http://img249.imageshack.us/img249/7245/bscap0015 fb3.jpg', 424);" /></div>
Reply With Quote
  #53  
Old 09-09-2007, 12:41 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by pspmaster93 View Post
can you include a readme guide for updating from the previous version?
thincom2000, I think is best for you to release the hack under your own version.
People will ask all the time for support on a piece of code that I did not make... Thanks.
Reply With Quote
  #54  
Old 09-09-2007, 12:28 PM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You suggest making file edits instead of using plugins? (for all products - hacks)

Yeah, it'll be faster but it'll also take so many time when upgrading...
Reply With Quote
  #55  
Old 09-09-2007, 03:48 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It will take you 30min max to upgrade a heavy modified board... if you know what you are doing. Plus the difference between editing directly the files, compared to hooks usage, is huge. Even the vBulletin developers said that writing the code directly to files is way better then using the hooks. Then, even if you use only hooks, there is no guarantee the code will still work on the new vBulletin version, so you are stuck already. While editing the code by yourself, you learn about PHP and see exactly what it has to be done, in order to fix everything.

The hooks are for people who don't code or are lazy to learn few basics in PHP. Then, why do you want to download hacks if you don't want to learn anything? And how do you know that the plugins you just installed will not destroy your server? Don't take it on a bad way, I simply state the real facts: using hooks is slowing down your code execution. That is compared on real benchmarks. Plus, I bet you 1 million dollars, no (or very few) "hackers" will test their code with benchmarks... just to see how their hack will perform under heavy server stress. You have no idea how many bad hacks you can find here at vBulletin.org site.

The code thincom2000 made is good from a technical point of vue. But what do you think it will execute faster: my 5 lines of code grouped in one location... or his 200 lines spread all over the hooks and templates? Many people don't realize how bad it is to load your board with a lot of hook inserted code.

I'm totally against modifying your vBulletin board. I don't see any need to add a ton of hacks that will not do any good to your server performance. But if I'm forced to do it, I will definitely edit the vBulletin files. I deal with a lot of clients, like corporate people. I build their server from scratch, including the OS with my own RPM's (PHP, MySQL, etc.) and all the needed software for high performance machine/s. Then, when I install vBulletin, I will always recommend not to insert any hacks on it.
Reply With Quote
  #56  
Old 09-09-2007, 03:53 PM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the detailed answer.
Reply With Quote
  #57  
Old 09-09-2007, 04:14 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks and let me state this one more time: thincom2000 did a very good job on the code modification. This has nothing to do with my comments listed above. It is just my personal opinion about using code in hooks.
Reply With Quote
  #58  
Old 09-09-2007, 06:27 PM
thincom2000 thincom2000 is offline
 
Join Date: May 2006
Location: Bronx, NY
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For the ease of support and less confusion in this thread, I have taken TECK's suggestion and opened a support thread for the modified product file I posted earlier. The file is now only available in that thread.

https://vborg.vbsupport.ru/showthread.php?t=157428

Quote:
Originally Posted by xandizitxu View Post
Okay I installed your product xml, uninstalled the other and now I get this
Please repost your issue in the other thread, and I will gladly tell you how to fix it, since this was my very first issue when I took on the task of pluginifying it as well.
Reply With Quote
  #59  
Old 09-09-2007, 09:08 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good decision, Ted. Congrats on the mod, BTW.
Reply With Quote
  #60  
Old 09-10-2007, 06:24 PM
JohnnieOO JohnnieOO is offline
 
Join Date: Sep 2007
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, if I am reading this correctly, when installed this will resize pictures as they are uploaded from the user's computer but before being saved on the server? However, they must be attached and not installed with [img] tags? Am I reading this right?

Johnnie
Reply With Quote
  #61  
Old 09-10-2007, 06:44 PM
djdonx djdonx is offline
 
Join Date: May 2007
Location: Manchester, England
Posts: 222
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Johnnie,

When a user puts an image url in [IMG] tags, if the image is bigger than the size you have specified it will shrink the image and make the original image a link.

Also, this works perfect for me. Installed.
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 06:08 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.08065 seconds
  • Memory Usage 2,314KB
  • 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
  • (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
  • (4)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