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

Reply
 
Thread Tools
Resize Images with BB Code Tags Details »»
Resize Images with BB Code Tags
Version: 1.00, by nerbert nerbert is offline
Developer Last Online: Aug 2017 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 4.1.12 Rating:
Released: 09-04-2012 Last Update: Never Installs: 17
Re-useable Code  
No support by the author.

This new BBcode allows images to be resized to any allowed size. The tags work like this:

[RESIZE=100][ATTACH=CONFIG]2621[/ATTACH][/RESIZE]

or

[RESIZE=100][IMG]http://www.mypics.com/gallery/picture.jpg[/IMG][/RESIZE]

This will set the image width to 100px. The tags create a span with the specified width around the image and a CSS script sets the image width to inherit from the span

Title: Resize Images

BB Code Tag Name: resize

Replacement:

HTML Code:
<style type="text/css">.resize img{width:inherit;}</style>
<span style="width:{option}px;" class="resize">
	{param}
</span>

Example: [resize=100][ATTACH=CONFIG]2621[/ATTACH][/resize]

Description: Allows image resizing.

Use{option}: Yes

Button Image: http://www.myforum.com/forum/images/editor/resize.png (Create a link to your actual forum)

Remove Tag If Empty: Yes

Disable BB Code Within This BB Code: No

Disable Smilies Within This BB Code: No

Disable Word Wrapping Within This BB Code: No

Disable Automatic Link Parsing Within This BB Code: No

Download the button then upload to forum/images/editor. Create the proper link for the button image. Fill in the rest of the BB Code settings and you are done. This should work on all vB4 and vB3 versions.

Screenshots

File Type: png lincoln.png (180.0 KB, 0 views)

Show Your Support

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

Comments
  #2  
Old 09-06-2012, 01:21 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I completely changed how this works. In the original version JavaScript detected an onload event and that would fire a function that would use DOM to set the image width to match the specified span width.

HTML Code:
<span style="width:{option}px" name="resize">
	{param}
</span>
<script type="text/javascript">
<!--
	function resize(event) { 
		var image = is_ie ? event.srcElement : event.target ;
		if(image.tagName=='IMG'){ 
		if(image.parentNode.getAttribute('name')=='resize'){ 
		if(image.style.width!=image.parentNode.style.width){
			image.style.width = image.parentNode.style.width
		}}}
	}
	if (document.addEventListener) {
		document.addEventListener("load", resize, true);
	} 
	else if (document.attachEvent) {
		document.attachEvent("onload", resize);
	}
//-->
</script>
Now the image width is simply inherited from the span. Much simpler!

If you have already created this BB code replace the HTML with the present code., everything else is the same
Reply With Quote
  #3  
Old 10-10-2019, 03:00 PM
clarknovak clarknovak is offline
 
Join Date: Apr 2013
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Still works with VB5, but only the original code: the updated code does not perform the resize and displays a full-size image.
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 12:57 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.03541 seconds
  • Memory Usage 2,232KB
  • Queries Executed 17 (?)
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
  • (2)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (2)postbit
  • (1)postbit_attachment
  • (3)postbit_onlinestatus
  • (3)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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete