Advertisement:

Author Topic: Post and PM Inline Attachments  (Read 153677 times)

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Post and PM Inline Attachments
« on: July 26, 2014, 09:14:08 PM »
Link to Mod


POST & PM INLINE ATTACHMENTS v6.0
By Dougiefresh -> Link to Mod


Introduction
This mod adds the ability to position your attachments in either your forum post or your personal message post using [attachment=n][/attachment] bbcode (where n is the number of the attachment in the post, eg first = 0, second = 1).

NOTICE:  In order to support inline attachments in personal messages (PMs), you are REQUIRED to have the PM Attachments mod VERSION 2.6 OR BETTER installed, prior to this installation of this mod!!

New BBcodes
This mod supports 5 new bbcodes in order to position your attachments inline:
o attachment => Show full expanded picture
o attach => Show thumbnail, expandable to full picture
o attachthumb => Show thumbnail ONLY, not expandable
o attachmini => Show thumbnail, expandable to full picture
o attachurl => Shows attachment size, iamge dimensions, and download count; no picture

BBcodes Parameters
Each new BBCode accepts the following formats:
Code: (Version 1.x) [Select]
[nobbc][attach=[/nobbc][b]{id}[/b]][/attach]
[nobbc][attach=[/nobbc][b]{id}[/b],[b]{width}[/b]][/attach]
[nobbc][attach=[/nobbc][b]{id}[/b],[b]{width}[/b],[b]{height}[/b]][/attach]
In each case, {id} is the attachment number relative to the topic, {width} is the max desired width, {height} is the max desired height, {pixels} is the number of pixels surrounding the image, and {float} can be either left, right, or center.  All text between the opening and closing attachment tags is discarded.

Version 2.0+ BBcode Parameters
Version 2.0+ introduced a new format that allows the following parameters:
Code: (Version 2.x) [Select]
[nobbc][attachment[/nobbc] id=[b]{id}[/b] {parameter}={value}][/attachment]
Allowed parameters:
id{attachment id}ID number of the attachment to show inline (NOT attachment number!)
width{width}Desired width of image to show.  Valid: positive integers.
height{height}Desired height of image to show.  Valid: positive integers.
float{float}Floats image to relation to everything else.  Valid: left, right, center
margin{pixels}Margin around inline attachment.  Valid: positive integers
margin-left{pixels}Left margin around inline attachment.  Valid: positive integers
margin-right{pixels}Right margin around inline attachment.  Valid: positive integers
margin-top{pixels}Top margin around inline attachment.  Valid: positive integers
margin-bottom{pixels}Bottom margin around inline attachment.  Valid: positive integers
border-style{style}Border style.  Valid: none, dotted, dashed, solid, double, groove, ridge, inset, outset
border-width{pixels}Border width around inline attachment.  Valid: positive integers
border-color{color}Border color.  Valid formats: plain text, #xxx, #xxxxxx, rbg(d,d,d)
scale{answer}Override scaling of image.  Valid: true, false, yes, no
msg{msg ID}Message ID number.  Valid: positive integers.
In each case, {id} is the attachment number relative to the topic, {width} is the max desired width, {height} is the max desired height, {pixels} is the number of pixels surrounding the image, and {float} can be either left, right, or center.  All text between the opening and closing attachment tags is discarded.

Version 3.0+ BBcode Format
Version 3.0 makes further changes and allows the use of the inline attachments bbcodes WITHOUT closing brackets, as well as using attachments from another post!

Version 3.11 makes further changes and allows the use of closed tags, like [attach].  This new form is autonumbered!  Note that the [attach] tag is processed first, then [attachment], then [attachmini], then [attachthumb], then [attachurl].

Other Mod Features
o Error Text strings are shown for invalid/missing/deleted attachments.
o Inline attachment processes takes place in the parse_bbc function, which means any parsing requests can benefit from this mod!
o Text string is shown as alternative in code
o Adds [Insert Attachment x] next to each attachment/upload box to insert the bbcode.
o Attachments used by the inline attachments mod can be omitted from the attachment display at the bottom of the post
o Reloads the attachments for Ajax Editing.
o Removing an attachment removes the attachment bbcode for that attachment & changes remaining attachment tags to ensure proper post appearance.
o Text between inline attachment brackets are removed (as of version 3.0).
o Automatic modification of boilerplates that use the ILA tags within them when changing "1-based" numbering option.

Admin Settings
The bbcode may be disabled by going to Admin -> Forums -> Posts and Topics -> Bulletin Board Code and unchecking the attachment bbcode.

On the Admin -> Layout -> Attachments and Avatars -> Inline Attachments page, there are several new options:
o Remove attachment image under post after in-post use.
o Use "One based numbering" for attachment IDs (first attachment is 1 instead of 0).
o Allow quoted attachment images from another post.
o Show download link and counter under inline attachment, like non-inline attachments.
o Turn off "nosniff" option for IE and Chrome browsers.
o Whether "attach" tag is the same as the "attachment" tag.
o Allow playing inline attachments that are videos.
o Use Highslide effects for inline attachments. (only if supported Highslide mod is installed)
o Show EXIF information (only if EXIF mod is installed)

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

For SMF 2.1 Beta 3, this mod contains no functionality for PM attachments, and posting regular attachments has been changed slightly to allow only 1 file per input box.

These mods can be installed at any time (not required):
o JQLightBox
o SCEditor4Smf
o EXIF
o Boilerplates for Posts

These mods should be installed before this mod (not required):
o Highslide Image Viewer
o HS4SMF v0.8.1
o PM Attachments
o Custom View of Attachments

Changelog
The changelog has been removed and can be seen at XPtsp.com.

License
Quote
Copyright (c) 2013 - 2017, 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.
« Last Edit: January 19, 2015, 09:42:22 AM by dougiefresh »
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #1 on: July 28, 2014, 06:44:18 PM »
Uploaded v1.1 - July 28th, 2014
o Fixed two undeclared array element errors in PersonalMessage.template.php...

EDIT: Fixed inccorect year in release info....
« Last Edit: August 11, 2014, 12:23:34 PM by dougiefresh »
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline grimmoire

  • Newbie
  • *
  • Posts: 4
Re: Post and PM Inline Attachments
« Reply #2 on: July 30, 2014, 01:39:36 PM »
Hello!

Thank you for this mod.

But i have one problem after installation. When i create new topic, i can insert inline attachment only for first attachment, for others link is not displayed:



If i create topic or message and edit it later, everything all right.

Highslide4SMF is installed.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #3 on: August 01, 2014, 07:53:18 PM »
Hello!

Thank you for this mod.

But i have one problem after installation. When i create new topic, i can insert inline attachment only for first attachment, for others link is not displayed:



If i create topic or message and edit it later, everything all right.

Highslide4SMF is installed.
I'm gonna have to figure out why this is happening....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline nuberry

  • Semi-Newbie
  • *
  • Posts: 11
Re: Post and PM Inline Attachments
« Reply #4 on: August 04, 2014, 07:50:03 AM »
Hi there
looks like a great mod, however when i load it says  - Test failed (Ignore Errors)

is this okay , should i ignore or is there a conflict

many thanks
andrew

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #5 on: August 04, 2014, 07:47:13 PM »
Not having the PM attachments mod installed will result in the "Test Failed (Ignore Errors)" message.  The Post Inline Attachments will work, but PM Inline Attachments won't work without PM Attachments mod installed.
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #6 on: August 11, 2014, 04:05:41 PM »
Hello!

Thank you for this mod.

But i have one problem after installation. When i create new topic, i can insert inline attachment only for first attachment, for others link is not displayed:



If i create topic or message and edit it later, everything all right.

Highslide4SMF is installed.
I'm gonna have to figure out why this is happening....
I apologize about the late response....

UPDATE: I've got the Post inline attachments working correctly, however, the PM inline attachments is giving me trouble.  Will keep at it until I get it fixed....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #7 on: August 11, 2014, 05:35:50 PM »
Uploaded v1.2 - Auguset 11th, 2014
o Fixed some undefined language string errors found in mod
o Modified code to insert attachments after pressing "More Attachments" in Posts and PMs
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline Sweetwater

  • Semi-Newbie
  • *
  • Posts: 90
  • Gender: Male
    • SWFishing on Facebook
    • @SweetWaterFish on Twitter
    • Sweetwater Fishing Australia
Re: Post and PM Inline Attachments
« Reply #8 on: August 16, 2014, 08:46:48 AM »
A great idea for a mod. However I'm having same problem as above after installing v1.2 on smf 2.08

Can only add one attachment now, but the first attachment inserts exactly as described. Attempt to add more attachments it jumps to top of page and nothing else. Same as when editting a post and trying to add another attachment.

A great attempt at a good idea, thanks for your efforts but will need to uninstall on my forum.

Kind regards

Offline saurabh1938

  • Semi-Newbie
  • *
  • Posts: 85
    • Gotripperz
Re: Post and PM Inline Attachments
« Reply #9 on: August 16, 2014, 06:04:25 PM »
This is the MOD that is most important for my forum. I am eagerly waiting for the bug fix... Currently after the fresh install, when I click on more attachment, it takes me to somewhere else. I am looking forward for the bug fix and refreshing this page every couple of hours. Please let me know by when you would be able to fix this thing.... but superb effort and appreciate your help.
Visit my forum : www.gotripperz.com

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #10 on: August 16, 2014, 09:22:13 PM »
Sigh...  :o Damn....  I thought I took care of this issue  ???  Lemme look into it again.....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #11 on: August 17, 2014, 08:32:05 AM »
Uploaded v1.3 - August 17th, 2014
o Fixed javascript code for issue with pressing "More Attachments" in Posts.

Thank you for the bug reports, grimmoire, Sweetwater and saurabh1938!!  I overlooked one stupid little variable in Post.template.php, which was why it wasn't working.  Amazingly, I had fixed it on my localhost forum, but forgot to transcribe my changes back into the install.xml file....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline saurabh1938

  • Semi-Newbie
  • *
  • Posts: 85
    • Gotripperz
Re: Post and PM Inline Attachments
« Reply #12 on: August 17, 2014, 05:23:57 PM »
Thanks for the fix! It is working great

One thing I want point out here is: It is working great on Internet Explorer ... but it is not working on Chrome.

On Chrome when I click on (Insert Attachment n), Nothing happens. Please look into this issue as well, as most of the users use chrome these days..

Anyways I want to thank you for this MOD as my forum is based on Photos and its a very important MOD for me.
Visit my forum : www.gotripperz.com

Offline marcosdjcm

  • Newbie
  • *
  • Posts: 5
Re: Post and PM Inline Attachments
« Reply #13 on: August 19, 2014, 07:39:10 AM »
Hi,

I like the idea of this mod but I am getting inline links instead of inline images:





Am I doing something wrong? Would like the image to be displayed inline like I have done in this post. Thanks.

Offline saurabh1938

  • Semi-Newbie
  • *
  • Posts: 85
    • Gotripperz
Re: Post and PM Inline Attachments
« Reply #14 on: August 19, 2014, 11:33:48 AM »
when you post this message you will see the image, while in edit mode, it looks like this only.

Btw which browser are you using?
Hi,

I like the idea of this mod but I am getting inline links instead of inline images:





Am I doing something wrong? Would like the image to be displayed inline like I have done in this post. Thanks.
Visit my forum : www.gotripperz.com

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #15 on: August 20, 2014, 04:39:00 PM »
Can you attach the image in question?  This way, I can look at the problem with that particular attachment.....
« Last Edit: August 22, 2014, 07:15:10 PM by dougiefresh »
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline saurabh1938

  • Semi-Newbie
  • *
  • Posts: 85
    • Gotripperz
Re: Post and PM Inline Attachments
« Reply #16 on: August 20, 2014, 06:28:57 PM »
Can you attach the image in question?  This way, I can look at the problem with that particular attachment.....

Hi, would you be able to look at the issue of this mod not working on Chrome or Firefox. When I click on Insert Attachment, nothing happens but on IE it works like a charm

Thanks,
Saurabh
Visit my forum : www.gotripperz.com

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #17 on: August 20, 2014, 06:46:32 PM »
I will look into it.  Sorry about not responding to your earlier message....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline saurabh1938

  • Semi-Newbie
  • *
  • Posts: 85
    • Gotripperz
Re: Post and PM Inline Attachments
« Reply #18 on: August 21, 2014, 04:14:31 PM »
I will look into it.  Sorry about not responding to your earlier message....

Thanks in advance, for taking out the time and looking into the issue. As I mentioned earlier, this MOD and hence your help is very crucial for my forum. I am eagerly awaiting a fix.
Visit my forum : www.gotripperz.com

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,423
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #19 on: August 21, 2014, 05:04:41 PM »
Hi,

I like the idea of this mod but I am getting inline links instead of inline images:

Am I doing something wrong? Would like the image to be displayed inline like I have done in this post. Thanks.
This mod uses the attachment data provided by the core forum software in order to decide how to display the attachment.  If the attachment is NOT an image, what you get is the text/link that you got.  If the attachment IS an image, then you should see the image in the post.  However, my code is not responsible for determining whether or not the attachment is an image or not.  That responsibility falls to the core forum software.  The fact that the core forum software does not recognize the image as such suggests that the image in question is corrupt OR not encoded in such a way that the core forum software can process it as an image.
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!