News:

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

Main Menu

Post and PM Inline Attachments

Started by dougiefresh, July 26, 2014, 09:14:08 PM

Previous topic - Next topic

RSI

Doug,

The concern that I had is when people go to eventually upgrade to SMF v2.1 when it's released. Since that will more than likely require a clean install, but still leaving all data intact, except for all mods and hooks everyone will be looking for an alternative if the ILA mod is not updated. Those guys have moved on to other things and unless someone updates that ILA mod then what will everyone do when they have attach=n already contained within years of posts? I will be one of those people for example. I guess there might be a way to manually do a find and replace using phpMyAdimin but if you make a mistake, yikes :-\

Anyway, looks like you are working on it and glad the others finally brought it up too.

dougiefresh

Give me a few more days.  I've gotten the "one-based numbering" option to work (as opposed to "zero-based numbering", which is what PHP uses for the arrays when an index number isn't specified).  So the first post is referred to as attachment 1 instead of attachment 0 when the option is enabled.

However, I found a major bug in the attachment removal code, where it concerns inline attachments and the [attachment id=0] form.  Seems it won't remove/correct the attachment numbers correctly without code modification....

dougiefresh

UPDATE: I've got the "one-based numbering" thingy working, removed any text between the brackets for inline attachments, the new form for the inline attachments working with the bbcode parser, and all bbcode forms are correctly removed from the message post (especially when removing attachments).  This was all done without modifying posts! 

I also removed the stupid bbcode button add-on from 2.8beta2, since it doesn't make things any easier and will probably rewrite at some future date....

What remains?  Well, since Suki was kind enough to point me in the right direction here, I'm going to try to get the SMF 2.1 editor working correctly with the inline attachments links that I'm adding to it....

dougiefresh

UPDATE: I've got the "one-based numbering" thingy working, removed any text between the brackets for inline attachments, the new form for the inline attachments working with the bbcode parser, and all bbcode forms are correctly removed from the message post (especially when removing attachments).  This was all done without modifying posts!  As a side note, it's amusing to me that the size of the package actually went DOWN during this rewrite!  :P

I also removed the stupid bbcode button add-on from 2.8beta2, since it doesn't make things any easier and will probably rewrite at some future date....

What remains?  Well, since Suki was kind enough to point me in the right direction here, I'm going to try to get the SMF 2.1 editor working correctly with the inline attachments links that I'm adding to it....

dougiefresh

#124
Uploaded v3.0 - April 17th, 2015
o Added msg parameter so that attachments from other posts can be included/quoted.
o Added code to allow inline attachments used in a post to be properly quoted.
o Added code to internally change the [attach=n] form to [attach=n][/attach] without modifying posts.
o Added code to remove text between brackets, aka [attach=0]This file[/attach] without modifying posts.
o Added option to use "One-based numbering" instead of "Zero-based numbering".
o Modified ID parameter so that invalid ID numbers are errored out instead of zeroed.
o Added option to make [attach=n] as same as [attachment=n] bbcodes.
o Fixed ILA_Remove_Tags function so that it removes the other 11 ILA bbcodes forms.
o Fixed ILA_Remove_Attachment function so that it removes the other 11 ILA bbcodes forms.
o Removed BBC buttton introduced in v2.8beta2 from the editor.
o Language strings are in seperate file and now loaded from Subs-InlineAttachments.php.
o Moved code responsible for setting topic ID (2.8beta3 fix) into Subs-InlineAttachments.php.

Please note that SMF 2.1 Beta 1 post UI modifications still does not work correctly yet.  It is being worked on, though....

WARNING!!!  You MUST uninstall your current version before installing this version!  There are major changes in v3.0 that will cause problems with your forum, up to and including PHP fatal errors, if you simply copy Subs-InlineAttachments.php over your existing copy!!!

Stanyy

Quote from: dougiefresh on April 17, 2015, 10:16:18 PM
Uploaded v3.0 - April 17th, 2015
o Added msg parameter so that attachments from other posts can be included/quoted.
o Added code to allow inline attachments used in a post to be properly quoted.
o Added code to internally change the [attach=n] form to [attach=n][/attach] without modifying posts.
o Added code to remove text between brackets, aka [attach=0]This file[/attach] without modifying posts.
o Added option to use "One-based numbering" instead of "Zero-based numbering".
o Modified ID parameter so that invalid ID numbers are errored out instead of zeroed.
o Added option to make [attach=n] as same as [attachment=n] bbcodes.
o Fixed ILA_Remove_Tags function so that it removes the other 11 ILA bbcodes forms.
o Fixed ILA_Remove_Attachment function so that it removes the other 11 ILA bbcodes forms.
o Removed BBC buttton introduced in v2.8beta2 from the editor.
o Language strings are in seperate file and now loaded from Subs-InlineAttachments.php.
o Moved code responsible for setting topic ID (2.8beta3 fix) into Subs-InlineAttachments.php.

Please note that SMF 2.1 Beta 1 post UI modifications still does not work correctly yet.  It is being worked on, though....

WARNING!!!  You MUST uninstall your current version before installing this version!  There are major changes in v3.0 that will cause problems with your forum, up to and including PHP fatal errors, if you simply copy Subs-InlineAttachments.php over your existing copy!!!

You are a genius man. I will install the mod today and see how it goes. Thank you!

Stanyy


Quote from: dougiefresh on April 17, 2015, 10:16:18 PM
o Added option to use "One-based numbering" instead of "Zero-based numbering".

Hi. When this option is selected, the bbc works ok but the link beside the first file upload field remains 0.

Another minor bug. When you preview a post with an inline attachment, it displays [invalid attachment] in the attachment's position.

RSI

I've had some spare time this week so I have been playing around with a live board with a clean install of SMF v2.09 and checking a few of these updated mods out.


  • I installed the ILA in-line attachments mod.

  • I then uploaded a couple of pics and placed them in-line.

  • I then uninstalled the ILA mod.

  • I then installed this new v3.0 mod.

  • It still wont recognize then difference in the attachment numbering.

  • The ILA mod created two in-line attachments, [attach=1] and [attach=2].

  • With this mod installed it only sees [attach=1] and not [attach=2] because it wants to use [attachment=0] and [attachment=1] instead.

I thought I read somewhere in one of the previous posts the issue had been addressed and corrected, but it doesn't currently seem to be working with a clean install of SMF v2.09. Was the ILA mod left installed, but just disabled when you ran your tests with this new mod or am I just mistaken and not understanding what I thought I read?

RSI

Oh... nevermind, my mistake...

I hadn't noticed you added the check box control setting via Modifications Settings. Last time I tried this mod none of the admin controls were there yet.

Checking that box made it work ;D

RSI

#129
Ok, I had to remove and redo this last post because I spoke too soon.


  • I hadn't noticed you added the "Check if first attachment should be numbered 1?" setting via Modifications Settings. The last time I tried this mod none of the admin controls were there yet.

  • Checking that box does correct everything that was placed in-line using the ILA mod, but now if you try to upload and place new attachments in-line using this v3.0 mod it still wants to make the first attachment [attachment=0] and not [attachment=1]. So with that box checked it wont display the [attachment=0] in-line.

  • The Highslide Image Viewer v1.7 mod here from the SMF mod site also no longer works for some reason when the images are placed in-line. However, it works fine as soon as I take them back out of being in-line where they appear at the bottom of the post again.
So it looks like there is still an issue with the attachment numbering along with some new problem when trying to use the Highslide Image Viewer v1.7 mod. Again, I just checked all of this using a clean SMF v2.09 install.

Update: I remember why the Highslide Image Viewer v1.7 wont work, it's because it wont work with the ILA in-line attachment mod. It might be because the Highslide Image Viewer v1.7 mod itself wont work with just the [attach=n] and it requires either [attach=n][/attach] or [attachment=n][/attachment].

RSI

Doug, believe it or not I have one final update.

Neither of the two Highslide mods work anymore so something is definitely broke. I know the Highslide Image Viewer v1.7 mod won't work with the In-Line ILA mod, but it looks like it's more than just that now with this Post and PM In-line Attachments v3.0 mod.

Non-working mods are...

1. Highslide 4 SMF, v0.8.1

2. Highslide Image Viewer v1.7

And, the problem with the attachment numbering appears to be that it does re-number them after checking that box which fixes all of the attachments that were placed in-line using the ILA mod, but it's not re-numbering the first new attachment placed in-line with this Post and PM In-line Attachments v3.0 mod. It makes the first one [attachment=0] instead of [attachment=1] when that check box is checked so it wont display the [attachment=0] in-line.

It's funny because with the Highslide 4 SMF, v0.8.1 mod installed I tried to attach two new photos after deleting them first and it created [attachment=0] and [attachment=2] completely skipping [attachment=1]. It did that a couple of times out of about five for some strange reason which was really odd. I don't see how the Highslide 4 mod could cause that :o

Anyway, I hope all of this helps. Luckily I had some time to play around with it today.

P.S. And I did install the Highslide 4 SMF, v0.8.1 mod first before installing the Post and PM In-line Attachments mod.

dougiefresh

@RSI:   Wow...  Let me look into these reports....

@Stanyy: You are right, I did miss that one....

dougiefresh

#132
    Quote from: Stanyy on April 22, 2015, 05:12:25 AM
    Hi. When this option is selected, the bbc works ok but the link beside the first file upload field remains 0.

    Another minor bug. When you preview a post with an inline attachment, it displays [invalid attachment] in the attachment's position.
    Thank you for the bug report.  Yup, I missed that one.....

    Quote from: RSI on April 22, 2015, 02:43:17 PM
    I hadn't noticed you added the "Check if first attachment should be numbered 1?" setting via Modifications Settings. The last time I tried this mod none of the admin controls were there yet.

    Checking that box does correct everything that was placed in-line using the ILA mod
    Yup, added that option to make it compatible with the ILA mod, but the option is not checked by default.

    Quote from: RSI on April 22, 2015, 02:43:17 PM
    but now if you try to upload and place new attachments in-line using this v3.0 mod it still wants to make the first attachment [attachment=0] and not [attachment=1]. So with that box checked it wont display the [attachment=0] in-line.[/li]
    [/list]
    Yup, I missed that one....

    Quote from: RSI on April 22, 2015, 02:43:17 PM
    The Highslide Image Viewer v1.7 mod here from the SMF mod site also no longer works for some reason when the images are placed in-line. However, it works fine as soon as I take them back out of being in-line where they appear at the bottom of the post again

    So it looks like there is still an issue with the attachment numbering along with some new problem when trying to use the Highslide Image Viewer v1.7 mod. Again, I just checked all of this using a clean SMF v2.09 install.
    Quote from: RSI on April 22, 2015, 02:43:17 PM
    Update: I remember why the Highslide Image Viewer v1.7 wont work, it's because it wont work with the ILA in-line attachment mod. It might be because the Highslide Image Viewer v1.7 mod itself wont work with just the [attach=n] and it requires either [attach=n][/attach] or [attachment=n][/attachment].
    Quote from: RSI on April 22, 2015, 05:23:37 PM
    Neither of the two Highslide mods work anymore so something is definitely broke. I know the Highslide Image Viewer v1.7 mod won't work with the In-Line ILA mod, but it looks like it's more than just that now with this Post and PM In-line Attachments v3.0 mod.

    Non-working mods are...

    1. Highslide 4 SMF, v0.8.1

    2. Highslide Image Viewer v1.7
    Let me investigate these bug reports....  I'm not aware of breaking compatibility with those mods....

    Quote from: RSI on April 22, 2015, 05:23:37 PM
    P.S. And I did install the Highslide 4 SMF, v0.8.1 mod first before installing the Post and PM In-line Attachments mod.
    Good to know.  One less thing to worry/wonder about....

    RSI

    #133
    I just uninstalled the mods in the correct reverse order and then reinstalled this Post and PM In-line Attachments mod again and then the Highslide Image Viewer v1.7 mod after and I then unchecked the "Enable Highslide effects for in-line attachment?" checkbox in "Modification Settings" and hit save. I then rechecked the box and hit save again and now the Highslide Image Viewer v1.7 mod is working again.

    I should have thought of that earlier today because I've seen where when installing some mods their defaults won't always get automatically selected even when the boxes are automatically checked during install and you have to go back and uncheck and then recheck the boxes so you might look at that. It's probably not always saving the correct settings in the database during install every time. I never touched that checkbox until now and it fixed it.

    I haven't tried installing the Highslide 4 SMF, v0.8.1 mod again, but the only other thing is making your mod save the first attachment as [attachment=1] and not [attachment=0] anymore. That should solve the numbering issue.

    P.S. Maybe make the "Enable Highslide effects for in-line attachment?" checkbox unchecked during install where people would need to go in there and check it afterwards would work?

    dougiefresh

    @RSI: I've added the forgotten template changes to the next version of the mod, and included in the package instructions a redirect to clear the file cache.  I'm still looking into the "renumbering upon deleting attachment" issue you mentioned...

    Quote from: RSI on April 22, 2015, 09:40:54 PM
    P.S. Maybe make the "Enable Highslide effects for in-line attachment?" checkbox unchecked during install where people would need to go in there and check it afterwards would work?
    The problem I have with this is that when people have the HS4SMF or similar supported mod installed, they expect things to remain working, especially if people are upgrading from an earlier version of the mod...  It might throw people off to be forced to re-enable the mod just because....  I'm thinking that the redirect that I added SHOULD solve the settings issue you're experiencing....

    RSI

    I was able to get the Highslide Image Viewer v1.7 mod to stop working again last night by unchecking all of the check boxes and hitting save then rechecking them again and hitting save once more. When I did that the Highslide Image Viewer v1.7 mod quit working again.

    I then went back and unchecked just the "Enable Highslide effects for in-line attachment?"check box and hit save then rechecked it and hit save once more and it started working again.

    I then went back and tried repeating that whole step again two more times doing all of the check boxes at once and it didn't stop working again, but maybe there is some combination when checking or unchecking those check boxes that would make the Highslide Image Viewer v1.7 mod stop working again.

    Something appeared to just be a little unstable. Anyway, let me know when you upload the next update and I'll try it and see what happens.

    dougiefresh

    #136
    Quote from: RSI on April 22, 2015, 05:23:37 PM
    And, the problem with the attachment numbering appears to be that it does re-number them after checking that box which fixes all of the attachments that were placed in-line using the ILA mod, but it's not re-numbering the first new attachment placed in-line with this Post and PM In-line Attachments v3.0 mod. It makes the first one [attachment=0] instead of [attachment=1] when that check box is checked so it wont display the [attachment=0] in-line.
    I've taken care of this particular issue.

    Quote from: Stanyy on April 22, 2015, 05:12:25 AM
    Another minor bug. When you preview a post with an inline attachment, it displays [invalid attachment] in the attachment's position.
    Still looking for this one....

    dougiefresh

    Uploaded v3.1 - April 24th, 2015
    o Viewing inline attachments now works for guests!
    o Edited posts will be changed to use the new Version 3.0-style tags.
    o Changed inserted inline attachment tag from [attachment=n][/attachment] to [attachment=n].
    o Added some forgotten template changes to make the One-based numbering option work correctly.
    o Fixed a bug so that quotes without message ID no longer remove inline attachments with message ID specifed.
    o Fixed bug so that floating inline attachment had a download link & counter beneath it when option is set.
    o Fixed a few undefined errors within Subs-InlineAttachments.php.
    o Fixed multiple bugs in ILA_Fix_Tags function.

    dougiefresh

    Uploaded v3.1 - April 24th, 2015
    o Fixed a bug preventing previewing posts from working correctly.
    o Viewing inline attachments now works for guests when viewing PM attachments permission is granted.
    o Edited posts will be changed to use the new Version 3.0-style tags.
    o Changed inserted inline attachment tag from [attachment=n][/attachment] to [attachment=n].
    o Added some forgotten template changes to make the One-based numbering option work correctly.
    o Fixed a bug so that quotes without message ID no longer remove inline attachments with message ID specifed.
    o Fixed bug so that floating inline attachment had a download link & counter beneath it when option is set.
    o Fixed a few undefined errors within Subs-InlineAttachments.php.
    o Fixed multiple bugs in ILA_Fix_Tags function.
    o Fixed undefined element error within Sources/Display.php.
    o ILA settings moved into a seperate area under Modification Settings, includes online version check.

    RSI

    It looks like everything else is working now, but the download links and counter have disappeared from under the inline attachments for some reason.

    I went into Modification Settings and unchecked and then rechecked "Show download link and counter under inline attachment?" but it's still not displaying them under the inline photos anymore. It was working in v3.0 and before, but now it's not anymore with v3.1

    I'm using the Highslide Image Viewer v1.7 mod.

    Advertisement: