Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons

Reply
 
Thread Tools
BBCode: Resize Image with Text Wrap Details »»
BBCode: Resize Image with Text Wrap
Version: 1.01, by midnz midnz is offline
Developer Last Online: Jan 2023 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 4.0.6 Rating:
Released: 08-17-2010 Last Update: Never Installs: 31
Re-useable Code Translations  
No support by the author.

Resize Image with Text Wrap BBCode

I created this BB Code for my own forum and thought I'd share it with the community.
This BB Code allows images to be posted at 200px Wide with text wrapping. Double-clicking the image enlarges it to 600px Wide. Single-clicking reduces the image size back to 200px Wide. The size/resize dimensions can easily be altered to suit your individual requirements. Just change the width= dimensions in the code below.

Demo Here

Instructions:
Open the BBCode Manager/Add New BBCode

Title: Resize Image

BB Code Tag Name: RI

Replacement:
Code:
<img src="{param}" width="200"  ondblclick='this.src="{param}";this.width=600' onclick='this.src="{param}";this.width=200' align="left" hspace="10">


Example:
[RI]image web address goes here[/RI]

Description: Post image at 200px Wide with text wrap. Double-click to enlarge to 600px Wide. Single-click to reduce back to 200px Wide.

Use {option}: No
Button Image (Optional): images/editor/ri.png (upload the attached image via FTP to /images/editor folder) Kindly supplied by VonDoom Post#6
Remove Tag If Empty: Yes
Disable BB Code Within This BB Code: Yes
Disable Smilies Within This BB Code: Yes
Disable Word Wrapping Within This BB Code: Yes
Disable Automatic Link Parsing Within This BB Code: Yes


Please mark as installed if you use this

__________________________________________________ ______________

V. 1.01
  • Removed height attributes to maintain image proportions (Thanks to djbaxter )

Screenshots

File Type: jpg Image Resize 1.JPG (170.7 KB, 0 views)
File Type: jpg Image Resize 2.JPG (121.1 KB, 0 views)

Show Your Support

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

Comments
  #12  
Old 08-19-2010, 01:24 AM
midnz's Avatar
midnz midnz is offline
 
Join Date: Jul 2010
Location: New Zealand
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Hippy View Post
Nice mod there midnz
thanks for your efforts
Seemed interesting so I test it out..

seems if you add the image to a post with a couple lines. ..
it over laps down wards into the sig area..
Not sure if any one noticed it yet
I sure will use it if this could be fixed ..
Thanks for noticing that issue. I'll have a look at fixing the problem tonight when I get back from my travels.

EDIT: I've spent a few hours trying different remedies with limited results so far. It seems that images and tables with align=left or align=right don't appear to work in posts any more without interfering with signatures whereas using align=center, align=top & align=bottom do work without interfering with signatures. [S]I'll have to ask over at vB.com to look further in to the problem.[/S] Problem solved.
Reply With Quote
  #13  
Old 08-19-2010, 11:57 PM
midnz's Avatar
midnz midnz is offline
 
Join Date: Jul 2010
Location: New Zealand
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Hippy View Post
Nice mod there midnz
thanks for your efforts
Seemed interesting so I test it out..

seems if you add the image to a post with a couple lines. ..
it over laps down wards into the sig area..
Not sure if any one noticed it yet
I sure will use it if this could be fixed ..
If you view the demo link posted in the first post of this thread you'll see that the second post of my demo thread shows that this BBCode works with minimal text added and without interfering with the posted signature.

The problem of signature interference appears to arise when you use image or table align="left or right" after editing your postbit.css with the instructions placed in this mod.

I've replaced

Admin CP -> Style & Templates -> Style Manager -> CSS Templates -> Postbit.css

PHP Code:
.postbitlegacy .after_content {
clear:right !important;

with
PHP Code:
.postbitlegacy .after_content {
    
positionrelative;
    
width100%;
    
clear:both;

...and your reported signature interference error has vanished.
Reply With Quote
  #14  
Old 08-20-2010, 02:57 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FYI, the warning message isn't 'bogus' at least not in this case... for various security reasons it's better to always enclose the {param} tags in double quotes rather then single quotes... while I highly doubt anyone will have a problem the following codes will not display the error and is technically a bit safer. (I swapped the single and double quotes):

Code:
<img src="{param}" width="200" height="150" ondblclick='this.src="{param}";this.height=450;this.width=600' onclick='this.src="{param}";this.height=150;this.width=200' align="left" hspace="10">
Also I'm not sure what the purpose of "<!{param}>" is- I don't know what it does and it seems to work fine for me without it.
Reply With Quote
  #15  
Old 08-20-2010, 03:37 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I meant to come back and comment on this, too. In fact, the errors I was receiving with a couple of other BBCodes were valid errors - some I could fix and some I couldn't.

As Bird of Prey says, don't ignore such errors - they do mean something and may create a vulnerability if ignored.
Reply With Quote
  #16  
Old 08-20-2010, 07:18 PM
midnz's Avatar
midnz midnz is offline
 
Join Date: Jul 2010
Location: New Zealand
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
FYI, the warning message isn't 'bogus' at least not in this case... for various security reasons it's better to always enclose the {param} tags in double quotes rather then single quotes... while I highly doubt anyone will have a problem the following codes will not display the error and is technically a bit safer. (I swapped the single and double quotes):

Also I'm not sure what the purpose of "<!{param}>" is- I don't know what it does and it seems to work fine for me without it.
Thanks very much for the advice and assistance. I've edited in the double quotes where they should have been. The "<!{param}>" was unnecessary and should've been removed after I'd finished testing. That's done now, cheers .

Quote:
Originally Posted by djbaxter View Post
I meant to come back and comment on this, too. In fact, the errors I was receiving with a couple of other BBCodes were valid errors - some I could fix and some I couldn't.

As Bird of Prey says, don't ignore such errors - they do mean something and may create a vulnerability if ignored.
Thanks for that advice. All fixed .
Reply With Quote
  #17  
Old 08-20-2010, 07:41 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Another issue: You've defined fixed values for height and width, both for the "thumbnail" and for the "enlarged" images.

If the image doesn't conform to the proportions of those sizes, you end up with a distorted image - in fact, both the thumbnail and the enlarged images are distorted in the test example - see attachment.

Also, this is still forcing the signature to wrap around the image along with the text, which isn't ideal.
Attached Images
File Type: jpg ri.jpg (24.9 KB, 0 views)
Reply With Quote
  #18  
Old 08-20-2010, 09:43 PM
midnz's Avatar
midnz midnz is offline
 
Join Date: Jul 2010
Location: New Zealand
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by djbaxter View Post
Another issue: You've defined fixed values for height and width, both for the "thumbnail" and for the "enlarged" images.

If the image doesn't conform to the proportions of those sizes, you end up with a distorted image - in fact, both the thumbnail and the enlarged images are distorted in the test example - see attachment.
As explained in my first post here "The size/resize dimensions can easily be altered to suit your individual requirements. Just change the width= and height= dimensions in the code below."
I've used this BBCode to display large local images of fixed proportions. Ideally there might be {option}s included for proportions however that is beyond the abilities of this learner driver I'm sorry. I'd be happy for anyone with the skills to improve the dimension constraints.

Quote:
Originally Posted by djbaxter View Post
Also, this is still forcing the signature to wrap around the image along with the text, which isn't ideal.
If you've made edits to your postbit.css as explained in this thread then you will have signature interference with image or table align="left or right". It's covered in post#12 above. If you check out my demo (second post in that thread) you'll see that this BBCode doesn't force the signature to wrap around the image and text unless you've made those postbit.css edits.
Also, the Preview Post will show the signature wrapping around the image and text, however when posted, it should display properly.
Reply With Quote
  #19  
Old 08-20-2010, 10:29 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know if it would work in this case but did you ever try using max-height and max-width tags instead? This isn't exactly my specialty but I know they exist.

You could add an {option} but either the small or large image would still be out of proportion, you can't have two options.
Reply With Quote
  #20  
Old 08-20-2010, 10:35 PM
midnz's Avatar
midnz midnz is offline
 
Join Date: Jul 2010
Location: New Zealand
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
I don't know if it would work in this case but did you ever try using max-height and max-width tags instead? This isn't exactly my specialty but I know they exist.
I was hopeful that using percentages might work but that was a failed test. I'll do some research/testing to see if/how your suggestion might work. Thanks for that .

Quote:
Originally Posted by BirdOPrey5 View Post
You could add an {option} but either the small or large image would still be out of proportion, you can't have two options.
Awesome! You've saved me a few hours of researching that idea . Cheers
Reply With Quote
  #21  
Old 08-20-2010, 11:11 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by midnz View Post
If you've made edits to your postbit.css as explained in this thread then you will have signature interference with image or table align="left or right". It's covered in post#12 above. If you check out my demo (second post in that thread) you'll see that this BBCode doesn't force the signature to wrap around the image and text unless you've made those postbit.css edits.
I have NOT made those edits and it is still wrapping the sig. See the attachment in my post above.

I use postbit, not postbit_legacy, as you can see from the screen capture in the attachment.
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 07:23 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.05075 seconds
  • Memory Usage 2,357KB
  • Queries Executed 26 (?)
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_code
  • (2)bbcode_php
  • (9)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)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
  • (3)postbit_attachment
  • (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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete