Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: dougiefresh on July 27, 2015, 09:59:28 PM

Title: Images with Margins and Borders
Post by: dougiefresh on July 27, 2015, 09:59:28 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=4067)



IMAGES WITH MARGINS AND BORDERS v1.8
By Dougiefresh (http://www.simplemachines.org/community/index.php?action=profile;u=253913) -> Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=4067)



Introduction
This mod adds several parameters to the "img" tag:
Quote
margin - Margin around the image.  Expressed in pixels.
margin-left - The image's left margin.  Expressed in pixels.
margin-right - The image's right margin.  Expressed in pixels.
margin-top - The image's top margin.  Expressed in pixels.
margin-bottom - The image's bottom margin.  Expressed in pixels.
Except for border-style, the border parameters are optional if borders around the image is desired:
Quote
border-style - REQUIRED! Border style.  Valid answers: dotted, dashed, solid, double, groove, ridge, inset, outset
border-width - Border width.  Expressed in pixels.
border-color - Border color.  Expressed either as #xxx, #xxxxxx, rbg(x,x,x), or {text}

Admin Settings
There are no admin settings to this mod.  To disable, you must uninstall this mod.

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

Changelog
The changelog can be viewed at XPtsp.com (http://www.xptsp.com/board/free-modifications/images-with-margins-and-borders/?tab=1).

License
Copyright (c) 2015 - 2019, 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.
Title: Re: Images with Margins and Borders
Post by: dougiefresh on July 29, 2015, 04:16:33 PM
Uploaded v1.1 - July 29th, 2015
o Rewritten to make "border-style" mandatory for use with "border-width" and "border-color".
o Added "img" tag without "border-style", "border-width", or "border-color" parameters.
Title: Re: Images with Margins and Borders
Post by: dougiefresh on July 30, 2015, 12:31:12 PM
UPDATE: Yesterday, I was notified of a potentially "fatal flaw" in SMF's bbcode parser function.  The parser generates an array with all possible permutations of the parameters, and thus can run out of memory when dealing with a bbcode tag with a large number of parameters.  I've solved this problem in my Post and PM Inline Attachments (http://custom.simplemachines.org/mods/index.php?mod=3770) mod, and I'm going to attempt to solve it for this mod as well....  It's a little more complicated because of the "alt" parameter in the mess of things....
Title: Re: Images with Margins and Borders
Post by: dougiefresh on July 30, 2015, 05:43:19 PM
Uploaded v1.2 - July 30th, 2015
o Performance increase due to modification of parse_bbc function to deal with memory issue found.
Title: Re: Images with Margins and Borders
Post by: margarett on July 30, 2015, 08:34:59 PM
Quote from: dougiefresh on July 30, 2015, 12:31:12 PM
I was notified of a potentially "fatal flaw" in SMF's bbcode parser function.
Hi dougie.

Sorry for the OT here (I'll split it later) but can you elaborate on this? We know that parse_bbc is a tremendous beast but I don't think I ever saw it causing memory issues, not even in the 2.0.7 upgrade with all the subsequent issues...
Title: Re: Images with Margins and Borders
Post by: dougiefresh on July 31, 2015, 09:23:08 AM
I started a topic here (http://www.simplemachines.org/community/index.php?topic=538611.0) to describe both the issue and my solution to the problem.  My opinion is that this needs to be a part of the core software.....
Title: Re: Images with Margins and Borders
Post by: margarett on July 31, 2015, 09:35:00 AM
Thank you :)
Title: Re: Images with Margins and Borders
Post by: dougiefresh on August 08, 2015, 11:04:00 AM
Uploaded v1.3 - August 8th, 2015
o Fixed the "fix parameter order" function so that it doesn't mangle the expected output.
Title: Re: Images with Margins and Borders
Post by: dougiefresh on September 04, 2015, 07:50:47 AM
NOTICE: In the nightly version found on GitHub, the SMF team has reworked the section of the parse_bbc function that used the permute function so that it no longer needs it, instead relying on a complete different implementation to address the issue brought up in the REPORT: Potentially "Fatal Flaw" in SMF's bbcode parser (http://www.simplemachines.org/community/index.php?topic=538611.0) thread.....  In the next few days, I will release an update that will make that particular operation optional....
Title: Re: Images with Margins and Borders
Post by: dougiefresh on September 04, 2015, 09:28:02 AM
Uploaded v1.4 - September 4th, 2015
o Operation that calls "fix parameter order" function now skipped for nightly SMF 2.1 Beta 2.
Title: Re: Images with Margins and Borders
Post by: woolly bugger on September 09, 2015, 12:54:14 PM
This mod isn't working for me... 

below is a list of installed mods...
Title: Re: Images with Margins and Borders
Post by: dougiefresh on September 09, 2015, 04:25:24 PM
Quote from: woolly bugger on September 09, 2015, 12:54:14 PM
This mod isn't working for me... 
More information would be helpful.  In what way does it not work for you?

If you have problems installing the mod, attach your Sources/Subs.php.....  Can't do anything until then....
Title: Re: Images with Margins and Borders
Post by: romanos8 on September 10, 2015, 02:59:30 AM
Hi, can you post an sample about how to include the Tag in the image code please?

Thanks
Title: Re: Images with Margins and Borders
Post by: dougiefresh on September 11, 2015, 09:40:50 AM
Quote from: romanos8 on September 10, 2015, 02:59:30 AM
Hi, can you post an sample about how to include the Tag in the image code please?
Sure!
[img width=600 border-style=solid]https://upload.wikimedia.org/wikipedia/commons/3/30/Chrysanthemum-purple-2.jpg[/img]
should produce a post like this:
(https://www.simplemachines.org/community/index.php?action=dlattach;topic=538493.0;attach=244458)
Title: Re: Images with Margins and Borders
Post by: Oceander on January 30, 2016, 10:09:36 AM
The Mod looks interesting; thanks for all the work!  And good luck with the upcoming knee surgery.
Title: Re: Images with Margins and Borders
Post by: aegersz on June 14, 2017, 07:16:57 AM
FYI - i had to uninstall this to get 2.0.14 to fit ... the whole story is at https://www.simplemachines.org/community/index.php?topic=554557

Title: Re: Images with Margins and Borders
Post by: dougiefresh on July 05, 2017, 02:39:17 PM
Uploaded v1.5 - July 5th, 2017
o Added support for SMF 2.0.14.




@aegersz:  Thank you for reporting the incompatibility.  It has been patched in this version!
Title: Re: Images with Margins and Borders
Post by: dougiefresh on August 31, 2017, 11:39:17 PM
Uploaded v1.6 - August 31st, 2017
o Fixed undefined array element error in mod.
Title: Re: Images with Margins and Borders
Post by: dougiefresh on October 19, 2018, 09:57:36 PM
Uploaded v1.7 - October 19th, 2018
o No functionality change.
o Updated documentation to point to new website.
Title: Re: Images with Margins and Borders
Post by: dougiefresh on May 22, 2019, 06:40:10 PM
Uploaded v1.8 - May 22nd, 2019
o Added support SMF 2.0 RC2.
o Removed support for SMF 2.1 Beta 2.
Title: Re: Images with Margins and Borders
Post by: KittyGalore on March 07, 2020, 01:59:38 PM
Just installed this mod how do you get the margin option to work i have the border style working what code do you use for the margin.