Post and PM Inline Attachments

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

Previous topic - Next topic

dougiefresh

#280
Quote from: CrescentEclipse on July 02, 2015, 04:38:28 AM
The misleading error message in preview mode [ You are not allowed to view attachments ]
Quote from: njtweb on July 02, 2015, 06:29:14 AM
Ok, I disabled WYSIWYG editor as well and I too have [you are not allowed to view attachments] now. While perms for all users are set to 'yes' to view attachments, (or checked)
Huh....  Thought I fixed this awhile back.... I can duplicate this bug report.

Quote from: CrescentEclipse on July 02, 2015, 04:38:28 AM
The message [ Invalid Attachment ] in quotes (with id) when the option "Allow quoted attachment images from another post?" is disabled (I think the mod should just be quiet here to not confuse the user too much)
I personally disagree with the mod being quiet in that situation.  Hwoever, I can add yet another option to silence the mod for this particular request.

Quote from: CrescentEclipse on July 02, 2015, 04:38:28 AM
When the option "Display image attachments as pictures under post" is disabled, the mod does not work (inline attachments are not displayed). This option seems essential to the mod, but does not allow the admin to only show download links under posts while showing inline attachments as images in posts! Makes no sense to me. Therefore I must use thumbnails to not waste screen space in the attachment section.
Hmmm....  Let me look into this bug report and get back to you...

Quote from: CrescentEclipse on July 02, 2015, 04:38:28 AM
I cannot use the advanced version 2.0 bbcodes. While the format [attachment={id},{width}][/attachment] works, e.g. the formats [attachment= id={id} width={width}][/attachment] and [attachment= id={id} width={width} float={float}][/attachment] do not. They only show plain text in the message. Sometimes the tag "id" gets changed to "1d". Strange...
You are including too many equal signs.  Immediately after the opening tag, you have an extra equal sign.  It should read like this:
[attachment id={id} width={width}][/attachment]

dougiefresh

UPDATE:  I've added support for playing video files in the AVI and DivX format (requires the DivX codec - HTML/BBCode courtsey of PhpBB3 BBcodes), WMV (requires Windows Media Player - HTML/BBCode courtsey of PhpBB3 BBcodes), and MP4 and OGG files (requires a HTML5 browser - HTML courtsey of W3Schools).

I've also added an option to silence all error messages that the mod used to output....

Anyways, I've done enough for today.  I'm going to bed....

CrescentEclipse

Quote from: dougiefresh on July 02, 2015, 04:48:09 PM
I personally disagree with the mod being quiet in that situation.  Hwoever, I can add yet another option to silence the mod for this particular request.

Quote from: dougiefresh on July 02, 2015, 10:18:08 PM
I've also added an option to silence all error messages that the mod used to output....

Hm, I was not suggesting to suppress all errors, only this particular one. I think, if a user quotes a post with an inline attachment, he/she maybe does not care about some bbcodes and just adds his/her message. In this case, the error message could imply the user himself/herself has done a mistake. Maybe I am thinking too much about comfort here?

Quote from: dougiefresh on July 02, 2015, 04:48:09 PM
You are including too many equal signs.  Immediately after the opening tag, you have an extra equal sign.  It should read like this:
[attachment id={id} width={width}][/attachment]

OKay, thank you, now the bbcode works. I am sure I tried this, but obviously did not :o
But you should update the info site of the mod, because I copied the bbcodes from there, including the redundant equal sign.

LG Cres

dougiefresh

Quote from: CrescentEclipse on July 03, 2015, 05:34:02 AM
Quote from: dougiefresh on July 02, 2015, 04:48:09 PM
You are including too many equal signs.  Immediately after the opening tag, you have an extra equal sign.  It should read like this:
[attachment id={id} width={width}][/attachment]

OKay, thank you, now the bbcode works. I am sure I tried this, but obviously did not :o
But you should update the info site of the mod, because I copied the bbcodes from there, including the redundant equal sign.

LG Cres
:o WHOOPS!!!  I've fixed it for the next version.... and fixed the info stuff of the mod, too....

dougiefresh

#284
Quote from: CrescentEclipse on July 02, 2015, 04:38:28 AM
The misleading error message in preview mode [ You are not allowed to view attachments ]
Quote from: njtweb on July 02, 2015, 06:29:14 AM
Ok, I disabled WYSIWYG editor as well and I too have [you are not allowed to view attachments] now. While perms for all users are set to 'yes' to view attachments, (or checked)
I've fixed this bug for the next version....  Beware that you still MUST complete uploading the attachment BEFORE you can preview it!  This is something that I haven't worked around yet....

Quote from: CrescentEclipse on July 03, 2015, 05:34:02 AM
Hm, I was not suggesting to suppress all errors, only this particular one. I think, if a user quotes a post with an inline attachment, he/she maybe does not care about some bbcodes and just adds his/her message. In this case, the error message could imply the user himself/herself has done a mistake. Maybe I am thinking too much about comfort here?
Hmm....  Okay.  I'll have to figure out how to implement that.  I've removed the suppress errors option from the mod for now....

CrescentEclipse

Great support dougie! Thank you a lot!

But I personally would prefer to have a fix for the two major bugs. You do not have to waste your time for some nice to have features ;)

dougiefresh

Believe me, I am looking at trying to fix them.....

dougiefresh

Believe me, I am trying to fix them.....  It's not like everything that can effect the output of this mod is contained in the Subs-InlineAttachments.php.  There are other places that the mod effects that can play havoc with my mod....

dougiefresh

#288
Quote from: CrescentEclipse on July 02, 2015, 04:38:28 AM
When the option "Display image attachments as pictures under post" is disabled, the mod does not work (inline attachments are not displayed). This option seems essential to the mod, but does not allow the admin to only show download links under posts while showing inline attachments as images in posts! Makes no sense to me. Therefore I must use thumbnails to not waste screen space in the attachment section.
I fixed this bug report, too....  Had to further modify Sources/Display.php in order to override that option so I could get what I needed to get to display the picture/video....

Quote from: CrescentEclipse on July 02, 2015, 04:38:28 AM
The misleading error message in preview mode [ You are not allowed to view attachments ]
Quote from: njtweb on July 02, 2015, 06:29:14 AM
Ok, I disabled WYSIWYG editor as well and I too have [you are not allowed to view attachments] now. While perms for all users are set to 'yes' to view attachments, (or checked)
This bug got unfixed....  Trying to figure out WTF I messed up...

Steve

DO NOT pm me for support!

dougiefresh

#290
Uploaded v3.8 - July 3th, 2015
o Fixed issue with post preview reporting not allowed to view attachments.
o Added override of "Display attachments as pictures under post" option to show pictures when disabled.
o Added an option to stop adding message ID to quoted inline attachments.
o Added an option to allow playing attached videos within the post.
o Added support for playing attached MP4, OGG and WebM video files (requires HTML5 browser or QuickTime).
o Added support for playing attached WMV files (requires Windows Media Player).
o Added support for playing attached AVI and DivX video files (requires DivX codec to be installed).
o Fixed undefined variable errors when certain mod settings don't get set during install.




@Everybody: I'm going to work on compatibility with the WYSIWYG mode next.

Quote from: Steve on July 03, 2015, 04:14:22 PM
Your avatar is so apropos ... :P
Yup....  Some days, yes, definitely....

CrescentEclipse

WOW!!! That was quick! Again, great support here!

I will review your code changes, because I woud like to understand where the problems were. (may take some time)
I also will test your new release and give feedback as soon as possible.

Quote from: Steve on July 03, 2015, 04:14:22 PM
Your avatar is so apropos ... :P

Indeed^^

CrescentEclipse

Quote from: dougiefresh on June 30, 2015, 06:29:09 PM
It seems that the ENTIRE problem is the mod's ability to add the message ID to the inline attachment tag when it is referenced between quotes....  I added a switch to disable that functionality so that the picture does show up where it is placed within the quote.  As soon as I figure out what is going on with the rest of the bug reports, I'll post the next version of the mod!

EDIT: What happens is when the inline attachment is placed between the quote tags, the mod attempts to modify the inline attachment tag so that the attachment is pulled from the quoted message instead of the current message.  When no message is referenced in the quote, it has no option but to strip out the inline attachments from that quoted message because it doesn't know what message to pull it from.  The code modification I did adds a switch to disable the described quote modification code....  Hope this helps you to understand what was going on....

Hey dougie

I have questions about that modification or perhaps a understanding problem.
We have an option to allow quoted attachments and an option to forbid processing quotes now.

Let me think of an example. What will happen if an user quotes a post with an inline attachment and uploads a new attachment which will be inserted between the original quote tags? (I think this was the source problem?) This scenario with the two optiones in all possible (4) conditiones?

Is the mod capable of handling this situation? What settings are required?
I hope you understand my questions or my reasoning. Thanks.

dougiefresh

#293
Quote from: CrescentEclipse on July 04, 2015, 05:20:05 AM
Hey dougie

I have questions about that modification or perhaps a understanding problem.
We have an option to allow quoted attachments and an option to forbid processing quotes now.

Let me think of an example. What will happen if an user quotes a post with an inline attachment and uploads a new attachment which will be inserted between the original quote tags? (I think this was the source problem?) This scenario with the two optiones in all possible (4) conditiones?

Is the mod capable of handling this situation? What settings are required?
I hope you understand my questions or my reasoning. Thanks.
Whoops....  This is what happens when I try to program when I'm tired....  ::)  :P  I'll remove the newly-introduced option....  I'll try to find the "source problem" report and fix that, too....

EDIT: Did a little thinking on your hypothetical situation.  I can alter what the mod places in the post so that the current message ID is attached to the new inline attachment.  For new posts, obviously they don't have a post ID at that time, so I'd have to resolve the bad post ID once the post has been saved to the database....

njtweb

Working perfectly now. Great support dude.!

CrescentEclipse

Hey hey, don't rush to a rash conclusion^^
Maybe I just miss the point. I think you had a reason for implementing these two different optiones?
If you want to explain it further, I will excitedly listen ;)
I don't want to confuse you :-X

EDIT

But does the quoted inline attachment has already an ID after you quoted it?

CrescentEclipse

#296
I'm done with the code review. Looks good to me, except one little slip in line 523. The $topic variable is refered to twice and I think $sourcedir isn't needed anymore? Anyways, I will install the update now and test a bit :)

Sry to keep bothering you, but the float=center tag does not work for me.
Is this a general problem or just me again? :laugh:

dougiefresh

#297
Quote from: CrescentEclipse on July 04, 2015, 08:15:20 AM
Hey hey, don't rush to a rash conclusion^^
Maybe I just miss the point. I think you had a reason for implementing these two different optiones?
If you want to explain it further, I will excitedly listen ;)
I don't want to confuse you :-X
Like I said, I was trying to program when tired.  I had forgotten I implemented an option to disable quoted inline attachments.

Quote from: CrescentEclipse on July 04, 2015, 05:20:05 AM
Let me think of an example. What will happen if an user quotes a post with an inline attachment and uploads a new attachment which will be inserted between the original quote tags? (I think this was the source problem?)
:o Sigh....  You just had to think up a situation that breaks the expected output of the mod, didn't ya?  :P  Version 3.9 addresses this situation by writing the message ID to the inline attachment tag when the "insert ILA" link is pressed....

Quote from: CrescentEclipse on July 04, 2015, 08:15:20 AM
But does the quoted inline attachment has already an ID after you quoted it?
Yes and no.  Under version 3.8 and below, what would happen is that the inline attachment tags would be modified with the message ID AFTER the user submitted it.  So inserting another ILA between the quotes that didn't belong to that quoted post would see that ILA tag assigned to the quoted post, not the new post you are writing....  As mentioned above, version 3.9 fixes this particular bug, so that when the user submits the entire post, the ILA tag already has an message ID attached to it and further modification isn't necessary.....

Quote from: CrescentEclipse on July 04, 2015, 10:11:32 AM
I'm done with the code review. Looks good to me, except one little slip in line 523. The $topic variable is refered to twice and I think $sourcedir isn't needed anymore? Anyways, I will install the update now and test a bit :)
Fixed this.

Quote from: CrescentEclipse on July 04, 2015, 10:11:32 AM
Sry to keep bothering you, but the float=center tag does not work for me.
Is this a general problem or just me again? :laugh:
I'll look into this report.  Version 3.9 makes sure that the parameters are in the correct order, so this might be the case with this particular bug report....

EDIT: Confirmed this bug....

dougiefresh

Uploaded v3.9 - July 4th, 2015
o Fixed the ILA float parameter so that float=center works as expected.
o Added code to make sure ILA tag parameters are in the correct order.
o Added code to add the message ID to quoted inline attachments BEFORE the user sees it.
o Removed the option added in v3.8 to stop adding message ID to quoted inline attachments.
o Altered templates to use version 2.0 bbcodes to insert inline attachments code.
o Altered templates to add the message ID to the insert inline attachments code.




Quote from: CrescentEclipse on July 04, 2015, 10:11:32 AM
Sry to keep bothering you, but the float=center tag does not work for me.
This was a CSS issue within the Subs-InlineAttachments.php file.  Turns out more CSS was needed in order to acheive the desired result...

CrescentEclipse

#299
Hi dougie, nice to see another new release ;)
I wasn't able to test version 3.8 fully and will therefore just go on to version 3.9.

Here are my results so far:

Subs-InlineAttachments.php, Line 635
A little style problem, I think. Additionally, when you just add a margin and no float, the download link will stick left regardless. Maybe it will be better to style the surrounding div whenever a download link is around here?

$divfloat = (isset($context['ila_params']['float']) ? ($context['ila_params']['float'] == 'center' ? ' style="margin-left: auto; margin-right: auto; display: block; "' : ' style="float: ' . $context['ila_params']['float'] . ';' . (!empty($context['ila_params']['margin']) ? ' style="margin:' . $context['ila_params']['margin'] . 'px' : '') . '"') : '');

New?
$divfloat = (isset($context['ila_params']['float']) ? ($context['ila_params']['float'] == 'center' ? ' style="margin-left: auto; margin-right: auto; display: block;"' : ' style="float: ' . $context['ila_params']['float'] . ';' . (!empty($context['ila_params']['margin']) ? ' margin: ' . $context['ila_params']['margin'] . 'px;' : '') . '"') : '');

The width tag does not work anymore. In the HTML code it looks like  width="240"
Has this something to do with the new param order?
Can you explain what the new function ILA_Fix_Param_Order does?

The override for inline attachment works, but the normal attachments under the post are displayed as images as well. But why? As far as I understand the code this should not happen, because only when ILA mod grabs the attachment context it sets the override, right?

I tried out our hypothetical scenario with the following result:

Test 1: Quoted msg with an ILA without a msg ID.
Quoted bbcode [attachment=1,msg12377] (v1 format, only if the previous attachment has no msg ID)
New ILA bbcode [attachment id=1 msg=new] between quote.
Works properly, but after I click "edit" I see [attachment id=1 msg=12392 msg=12377]
I mean, it works, but now we have both msg IDs. Looks strange.

Test 2: Same procedure, but first save and then edit post with new ILA.
Problem does not occure. New ILA bbcode [attachment id=1 msg=12392]

Test 3: Quoted msg with ILA with a msg ID
Quoted bbcode [attachment id=1 msg=12386] (v2 format)
New ILA bbcode [attachment id=1 msg=new] between quote.
Does not work at all. After "edit" I see [attachment id=1 msg=12386] twice. The new ILA is only under the post as attachment.

Test 4: Same procedure, but first save and then edit post with new ILA.
New ILA bbcode [attachment id=1 msg=12396]
Does not work at all. After "edit" I see [attachment id=1 msg=12396] twice. The new ILA is only under the post as attachment.

Same problem (like in test 3 and 4) when inserting the ILA outside the quote!

Final remarks:
It depends on the format of the ILA bbcode if the ILAs get messed up or not. Fixing posts is possible. You only can use the new ILA in the quote if the old (quoted) ILA has v1 format.

Thanks again :)

Advertisement: