News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Image Floating to Left or Right BBCode

Started by dougiefresh, December 01, 2014, 05:57:11 PM

Previous topic - Next topic

dougiefresh

Link to Mod



IMAGE FLOATING TO LEFT OR RIGHT BBCODE v1.22
By Dougiefresh -> Link to Mod



Introduction
This modification adds two BBCodes to allow a user to float an image to the left or right of the text.

The two BBCodes takes these forms:

[imgleft]{url}[/imgleft]
[imgright]{url}[/imgright]
[imgleft {params}]{url}[/imgleft]
[imgright {params}]{url}[/imgright]

where {url} is the image URL and the optional acceptable parameters are:

[b]alt[/b] - Alternate text if the event that the image can't be displayed.
[b]width[/b] - Width of the image.  Expressed in pixels.
[b]height[/b] - Height of the image.  Expressed in pixels.
[b]margin[/b] - Margin around the image.  Expressed in pixels.
[b]margin-left[/b] - The image's left margin.  Expressed in pixels.
[b]margin-right[/b] - The image's right margin.  Expressed in pixels.
[b]margin-top[/b] - The image's top margin.  Expressed in pixels.
[b]margin-bottom[/b] - The image's bottom margin.  Expressed in pixels.

Except for border-style, the border parameters are optional if borders around the image is desired:

[b]border-style[/b] - [b]REQUIRED![/b] Border style.  Valid answers: [b]dotted[/b], [b]dashed[/b], [b]solid[/b], [b]double[/b], [b]groove[/b], [b]ridge[/b], [b]inset[/b], [b]outset[/b]
[b]border-width[/b] - Border width.  Expressed in pixels.
[b]border-color[/b] - Border color.  Expressed either as [b]#xxx[/b], [b]#xxxxxx[/b], [b]rbg(x,x,x)[/b], or [b]{text}[/b]


Admin Settings
This BBCode may be disabled by going into the Admin => Forum => Posts and Topics => Bulletin Board Code and unchecking the bbcodes you don't want to use.  You may also be uninstall this mod in order to disable it.

Compatibility Notes
This mod was tested on SMF 2.0.10, but should work on SMF 2.1 Beta 1, as well as SMF 2.0 and up.  SMF 1.x is not and will not be supported.

SMF 2.1 Beta 2 Nightly (as of Sept 4th, 2015) has corrected the flaw reported in REPORT: Potentially "Fatal Flaw" in SMF's bbcode parser, thus the operation that calls the "fix parameter order" function is ignored for those nightlies.

Changelog
The changelog can be viewed at XPtsp.com.

License
Copyright (c) 2015 - 2018, Douglas Orend
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Shambles


dougiefresh

Quote from: Shambles on December 01, 2014, 06:02:34 PM
Thanks for the mod. Before I give it a go, is it much different to Nibogo's?

http://custom.simplemachines.org/mods/index.php?mod=2305
It is kinda different from Nibogo's, in that this mod is explicitly for images, and Nibogo's mod wraps the content between the opening/closing tags in a <div></div> construct....

dougiefresh

Uploaded v1.1 - December 5th, 2014
o Fixed bbcode code so that requested width and height are honored...

dougiefresh

Uploaded v1.2 - December 6th, 2014
o Added code to disable creation of the validation code if BBCode is disabled.

dougiefresh

Uploaded v1.3 - December 10th, 2014
o Added button for the bbcode.

dougiefresh

Uploaded v1.4 - December 17th, 2014
o Rewrote mod to use one validation function for all bbcodes in this mod.

drfun

Nice mod and well done,
I just tried the mod out and i notice the bbcode icon is not showing and it is over lapping each other. see the image below.
ECLIKS -Global Online community for Questions and Answers

dougiefresh

I just installed it on my test forum and confirmed that the mod does install the bbcode button images to the correct location.  Did you install the mod to the theme that you're using?  If not, you need to copy two images: themes\images\bbc\imgleft.gif and themes\images\bbc\imgright.gif, and place those images in your theme's images\bbc folder.  That should solve this particular issue.

If it doesn't, please let me know.

drfun

Thanks for the quick reply.
that has resolved the problem. Thanks alot
ECLIKS -Global Online community for Questions and Answers


dougiefresh

Uploaded v1.5 - December 29th, 2014
o Fixed image install locations within package-info.xml.

dougiefresh

Uploaded v1.7 - January 16th, 2015
o License change to Simplified BSD.  No functionality change.

Alanar

Hi! I'm getting this error when using a width or height property: Fatal error: Call to undefined function FImg_Param_Width() in root\forum\Sources\Subs.php on line 2097

Any help would be appreciated!

dougiefresh

Uploaded v1.8 - February 22nd, 2015
o Fixed bug report by Alanar regarding missing validation functions.

@Alanar: Thank you for the bug report!  I can't believe I missed something that glaringly obvious....  :-[

Alanar

Quote from: dougiefresh on February 22, 2015, 07:21:36 PM
Uploaded v1.8 - February 22nd, 2015
o Fixed bug report by Alanar regarding missing validation functions.

@Alanar: Thank you for the bug report!  I can't believe I missed something that glaringly obvious....  :-[
No worries. :)
I couldn't have made the mod myself with my newbie knowledge so you're already six steps ahead of me. ;)

Alanar

Woops, one more. When designating a specific height or width, the text jumps down to the bottom, beside the image, instead of at the top where it is supposed to be for the desired effect.

dougiefresh

@Alanar:  I've made a test post on my localhost forum and can't reproduce the issue you reported.  Are you using either the imgleft or imgright bbcode tags?  I believe using the img tag will produce the issue you're reporting....

If this isn't the case, please include the post (or relevant section of the post) that you're attempting to use with your forum so that I can try to figure out what is happening....

Alanar

Quote from: dougiefresh on February 23, 2015, 07:38:09 PM
@Alanar:  I've made a test post on my localhost forum and can't reproduce the issue you reported.  Are you using either the imgleft or imgright bbcode tags?  I believe using the img tag will produce the issue you're reporting....

If this isn't the case, please include the post (or relevant section of the post) that you're attempting to use with your forum so that I can try to figure out what is happening....
Never mind. I believe this was because of a styling modification I had made at the time. I've fixed the issue for my theme. :)

Thanks for the mod!

dougiefresh

Quote from: Alanar on February 24, 2015, 06:16:17 PM
Never mind. I believe this was because of a styling modification I had made at the time. I've fixed the issue for my theme. :)

Thanks for the mod!
Good to know.  Thanks for replying.

Advertisement: