![]() |
BBCode: Resize Image with Text Wrap
1 Attachment(s)
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
|
Quote:
any help plzzz thanxxxx |
I get that same error message for several custom BBCode entries. All of those BBCodes work fine. It's the error message itself that is in error.
|
I got same error message with some bbcodes, they work fine however. I use vBulletin 4.0.6
|
Quote:
|
1 Attachment(s)
This is going to be my most frequently used BB code. This really give a nice clean and pro feel. Installed and rated. Thanks a ton for this.. My staff is already running around editing our news forums. ;)
I also quick jammed out a button for this, just add it to your Images/Editor folder via FTP and add the Img url to the Button Image (Optional) location when creating your new custom BB code. |
Quote:
|
Quote:
I wanted to also add it works perfectly on the Blogs and CMS to. Actually is a great CMS product enhancement.. haha i just cant stop editing every other article on my home page now. I have nominated this little bad ass mambo jambo ;) |
Quote:
|
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 .. |
Quote:
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. |
Quote:
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:
PHP Code:
|
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"> |
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. |
Quote:
Quote:
|
1 Attachment(s)
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. |
Quote:
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:
Also, the Preview Post will show the signature wrapping around the image and text, however when posted, it should display properly. |
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. |
Quote:
Quote:
|
Quote:
I use postbit, not postbit_legacy, as you can see from the screen capture in the attachment. |
Regarding the imaghe distortion, this seems to work:
Code:
<img src="{param}" max-width="200" ondblclick='this.src="{param}";this.width=600' onclick='this.src="{param}";this.width=200' align="left" hspace="10"> I've just kept the width parameters and deleted the height paramaters. This shrinks the width and the height shrinks proportionately. Now there's just the problem of the signature wrapping. |
For me the above code displays the large picture when the page first loads- it should show the small image until it gets clicked.
|
Well with height removed now you could add an option, probably best to define the large width so you can use:
Code:
<img src="{param}" width="200" ondblclick='this.src="{param}";this.width={option}' onclick='this.src="{param}";this.width=200' align="left" hspace="10"> Double clicking enlarges the image to 800px wide. |
Change max-width to just width and it displays the small image by default I think:
Code:
<img src="{param}" width="200" ondblclick='this.src="{param}";this.width=600' onclick='this.src="{param}";this.width=200' align="left" hspace="10"> |
Quote:
When I was looking for reasons/solutions to fix the sig wrapping I tested adding/removing that Postbit.css edit mentioned in post#12 and replacing it with the following code and that fixed the issue for me. Prior to that I found that any example of image align="left" or align="right" caused signature wrapping. Would you mind trying the Postbit.css edit below to see if that fixes it for you please? NOTE: That edit did affect the postbit_legacy display for me. Postbit.css find: Code:
/*post bit*/ Code:
.postbitlegacy .after_content { If that edit doesn't work I'll be happy to provide you with copies of any templates that might help find clues to resolve it for you. Quote:
I'm hoping the sig wrapping might be easily solved for you now. |
Quote:
|
Quote:
Quote:
|
Quote:
Do you think that altering the code edit from postbitlegacy that I used, to postbit, might help? Code:
.postbit .after_content { |
I can't see how that would make a difference, since it's code I'm not using.
|
It won't make any difference. I've checked myself.
The best that can be achieved at present is to remove the align="left" from the code and forget about text wrapping until a solution can be found for those using the newer horizontal postbit layout. I came from vB3.6 where align="left" worked to vB4.0.5/6 where it doesn't work any more with the newer horizontal postbit display because of the signature interference issue. If I were still using 3.6 I'd find the signature code in the template and place <p></p> right before it to move signatures down. vB4 is somewhat more complex for me and I'm still coming to grips how it all works. The solution appears to me to be changing how the signature is displayed using the newer horizontal postbit layout. |
Quote:
Everything above {vb:raw template_hook.postbit_signature_start} went in the top row of the table. {vb:raw template_hook.postbit_signature_start} and everything below it went in the bottom row of the table. PHP Code:
http://img153.imageshack.us/img153/3...stbitedits.jpg http://img69.imageshack.us/img69/1475/postbitedits2.jpg |
an even cruder fix might be to put the signature in an invisible table - <table border="0" width="100%"><tr><td> SIG HERE <./td></tr></table>
But that would introduce a table to vb4's table-less design. |
Yeah.
Nice idea but I don't think it's going to work for me, I'm afraid. Thanks. |
Working perfect :)
|
Works great!
|
Great little trick this, how do you use the button image?
|
Quote:
Upload the "ri.png" image to your images/editor/ directory Edit your BBCode (bbcode manager) to include that image: http://img407.imageshack.us/img407/2535/bbcodeimage.jpg |
Thanks works good for me ..
|
Testing........ nice in vB 3.8.4!
|
Great but...is possible add a text in, like: "click to rezise this picture"???
|
All times are GMT. The time now is 04:48 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|