Advertisement:

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

Offline @rjen

  • Jr. Member
  • **
  • Posts: 166
  • Gender: Male
    • FJR-club Nederland
Re: Post and PM Inline Attachments
« Reply #680 on: October 20, 2017, 03:05:25 PM »
Updated, looking forward to next version...  ;)
Running SMF 2.0 with Tinyportal 1.3R at www.fjr-club.nl
Testing SMF 2.1 beta 3 with Tinyportal 2.0 at http://test2.fjr-club.nl/

Offline jakes_t

  • Semi-Newbie
  • *
  • Posts: 11
Re: Post and PM Inline Attachments
« Reply #681 on: November 03, 2017, 06:24:09 AM »
Great mod!

I've read through most of the thread but couldn't find anything related to the 2 bugs(?) I encountered:

1. Clicking (more attachments) to add another attachment, but leaving the browse box empty (ie, not adding another file) then clicking post gives a blank screen.


2. Feature or bug, I'm not sure - When editing a post to add more inline pics it will attach the next picture on the bottom as an attachment again. You have to the edit again a second time then go "insert attachment" then only does it go inline?

Installed mods:

1.    Avatars on Board/MessageIndex    
2.    Show JDALLAUI in Post and PM    
3.    Post and PM Inline Attachments    
4.    Resize Attached Images    2.4.1

Thanks!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,366
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #682 on: November 13, 2017, 11:25:40 AM »
@jakes_t: I will look into bug #1, as nobody else has reported that one.  Bug #2 is known and no solution has been found yet.
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 GL700Wing

  • Jr. Member
  • **
  • Posts: 253
  • Gender: Female
Re: Post and PM Inline Attachments
« Reply #683 on: November 14, 2017, 04:12:50 AM »
Bug #2 is known and no solution has been found yet.
I found a solution for this just now when I discovered that copying ./Sources/Subs-InlineAttachments.php from v5.6 fixed the problem.

I then discovered that making the following change in ./Sources/Subs-InlineAttachments.php from v5.11 also fixed the problem:
Find:
Code: [Select]
// Fetch attachments for use in "parse_bbc" function...
if (!isset($attachments[$msg_id]))
{
Replace With:
Code: [Select]
// Fetch attachments for use in "parse_bbc" function...
Find:
Code: [Select]
}

// Load the attachment context even if there are no attachments:
Replace With:
Code: [Select]

// Load the attachment context even if there are no attachments:

This change effectively reinstates the same code that was used in this section in v5.6 (although "unset($attachments[$msg_id])" was used in v5.6 and "$attachments[$msg_id] = array();" is used in v5.11) but obviously you will need to determine if this solution is appropriate or if it breaks something else ... :)

Offline GL700Wing

  • Jr. Member
  • **
  • Posts: 253
  • Gender: Female
Re: Post and PM Inline Attachments
« Reply #684 on: November 14, 2017, 06:18:39 AM »
I think I've found another bug ...

I have an SMF 2.0.14 forum with no other mods installed except forv5.11 of this mod (without any code changes made) and whenever I select a 'Download link and counter setting' of either 'Filename only', 'Filename and Size' or 'Filename, Size and Dimensions' (ie, either the second, third or fourth option from the drop-down list) all of the image details are displayed (ie, Filename, Size, Dimensions and Count) below the image.

Offline GL700Wing

  • Jr. Member
  • **
  • Posts: 253
  • Gender: Female
Re: Post and PM Inline Attachments
« Reply #685 on: November 14, 2017, 07:52:21 AM »
I think I've found another bug ...

I have an SMF 2.0.14 forum with no other mods installed except forv5.11 of this mod (without any code changes made) and whenever I select a 'Download link and counter setting' of either 'Filename only', 'Filename and Size' or 'Filename, Size and Dimensions' (ie, either the second, third or fourth option from the drop-down list) all of the image details are displayed (ie, Filename, Size, Dimensions and Count) below the image.

I've think I've worked out the fix for this bug too ... :)

In ./Sources/Subs-InlineAttachments.php
Find:
Code: [Select]
($download_count ? ($download_count >= 5 ? '<br/>' : ' ') . '(' . $attachment['size'] . ($attachment['is_image'] && !empty($dimensions['width']) ? ' - ' . $dimensions['width'] . 'x' . $dimensions['height'] . ($download_count == 6 ? ')<br/>(' : ' - ') . $viewed : ' - ' . $downloaded) . ')' : '').Replace With:
Code: [Select]
($download_count ? (($download_count >= 5 ? '<br/>' : ' ') . ($download_count >= 2 ? '(' . $attachment['size'] : '') . ($download_count >= 3 && $attachment['is_image'] && !empty($dimensions['width']) ? ', ' . $dimensions['width'] . 'x' . $dimensions['height'] : '') . ($download_count >= 4 ? (($download_count == 6 ? ')<br/>(' : ' - ') . ($attachment['is_image'] ? $viewed : ' - ' . $downloaded)) : '') . ($download_count >= 2 ? ')' : '')) : '') .

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,366
    • XPtsp.com Community
Re: Post and PM Inline Attachments
« Reply #686 on: November 14, 2017, 11:02:36 AM »
Uploaded v5.12 - November 14th, 2017
o Modified code to enclose ILA tag with "display: inline-block" CSS style, based on @rjen's code snipet..
o Fixed attachment not inline after editing post, per GL700Wing's instructions.
o Fixed download link/counter code for display, per GL700Wing's instructions.



@rjen and GL700Wing:  Thank you for finding and correcting the code fragments that were the source of the bugs that you found.  I apologize for not being around lately.  Life has been kicking me lately, but I'm fighting back (like normal)....

This change effectively reinstates the same code that was used in this section in v5.6 (although "unset($attachments[$msg_id])" was used in v5.6 and "$attachments[$msg_id] = array();" is used in v5.11) but obviously you will need to determine if this solution is appropriate or if it breaks something else ... :)
I was trying to prevent an unnecessary database call with that if...then statement.  It looks like it really was a necessary call to make...

1. Clicking (more attachments) to add another attachment, but leaving the browse box empty (ie, not adding another file) then clicking post gives a blank screen.
I'm still trying to find the time to look into this bug report.  I apologize for any inconvenience....
« Last Edit: November 14, 2017, 11:29:36 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 GL700Wing

  • Jr. Member
  • **
  • Posts: 253
  • Gender: Female
Re: Post and PM Inline Attachments
« Reply #687 on: November 14, 2017, 08:01:40 PM »
@rjen and GL700Wing:  Thank you for finding and correcting the code fragments that were the source of the bugs that you found.  I apologize for not being around lately.  Life has been kicking me lately, but I'm fighting back (like normal)....
You're welcome - happy to help when I can.

Offline pellet_newb

  • Semi-Newbie
  • *
  • Posts: 18
Re: Post and PM Inline Attachments
« Reply #688 on: November 18, 2017, 10:43:04 AM »
Any luck with Tapatalk support?  Thanks