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

GL700Wing

Quote from: ryry46d9 on August 28, 2021, 09:25:56 PMas you see everything looks fine but when I try to add the picture nothing happens
If nothing happens when you click on 'Insert Attachment' this suggests a JavaScript conflict.

Also, the 'attach' tag you entered manually is not correct if you are modifying an existing message - that's why you are getting the error message you see in your last image (and you don't actually need the [/attach] closing tag).  To manually insert an attachment in an existing message you should use the tag [attach id=N] where N is the attachment number.

Some questions:
1. Was this mod ever working properly on your forum?
2. Can you uninstall this mod without any errors?
3. If this mod uninstalls without any errors can you then reinstall this mod without any errors?
4. Did you install any mods after this mod and, if so, what are those mods?
5. Have you tried to install/uninstall this mod multiple times?
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

ryry46d9

the mod works fine with the admin account which is where I got the code from.

I forgot to add all my mods

1.   SMF-20-fix_birthdate (uninstall before 2.0.19)   1.0
2.   Stop Spammer   2.4.0
3.   New Topic in Seperate Color   1.3
4.   SimplePortal   2.3.7
5.   Post and PM Inline Attachments   7.01

if I try to remove it I get. I currently am using the curve theme. the forums are new.
You cannot view this attachment.
I uninstalled, removed and fetched a new version with same results 

GL700Wing

Quote from: ryry46d9 on August 29, 2021, 03:42:49 PMthe mod works fine with the admin account which is where I got the code from.

I forgot to add all my mods

1.    SMF-20-fix_birthdate (uninstall before 2.0.19)    1.0
2.    Stop Spammer    2.4.0
3.    New Topic in Seperate Color    1.3
4.    SimplePortal    2.3.7
5.    Post and PM Inline Attachments    7.01
I've setup a brand new SMF 2.0.18 forum with all these mods installed and using the same settings for this mod but I still can't reproduce the problem.

Quoteif I try to remove it I get.
You cannot view this attachment.
Your image attachment is missing.

Please post an image of the 'Start new topic' message window non-admin members see - example below.

Also, please post a copy of the ./Themes/Post.template.php file from your forum.


Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

ryry46d9

what the user sees
You cannot view this attachment.

what the admin sees
You cannot view this attachment.

the error I see (I probably forgot to insert)
You cannot view this attachment.

the php file
You cannot view this attachment.
 

GL700Wing

OK - I've confirmed that your Post.template.php file is correct.

The uninstall errors your posted are for the PersonalMessage.template.php file and would only be relevant if you had also installed the 'PM Attachments' mod - that's why you also see (Ignore Errors) after Test failed.

Would you please confirm that if a non-admin user clicks on the 'Choose File' button they can successfully select a file to attach and that they can also deselect the file by clicking on '(Clear Attachment)'.

Would you please let me know what computer/mobile device you are testing this on (eg, Windows/Mac/Linux computer or iOS/Android/Linux mobile device) and what browser you are using.

Finally, have you tested this issue using another browser and/or computer/mobile device?
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

ryry46d9

Quote from: GL700Wing on August 29, 2021, 10:33:46 PMOK - I've confirmed that your Post.template.php file is correct.

Then I really broke my forums  :'(

The uninstall errors your posted are for the PersonalMessage.template.php file and would only be relevant if you had also installed the 'PM Attachments' mod - that's why you also see (Ignore Errors) after Test failed.

That what I was thinking

Would you please confirm that if a non-admin user clicks on the 'Choose File' button they can successfully select a file to attach and that they can also deselect the file by clicking on '(Clear Attachment)'.

When I click on a file it will upload it and put them all at the bottom of the post either one can clear
 
Would you please let me know what computer/mobile device you are testing this on (eg, Windows/Mac/Linux computer or iOS/Android/Linux mobile device) and what browser you are using.

Android (S21ultra)Chrome win10(PC)Chrome win10(surface)Chrome

Finally, have you tested this issue using another browser and/or computer/mobile device?

I tried with Edge with the same results   

for right now I'm just going to give up, I have a lot of work that needs to get done. in a few weeks I'll come back to it.
It's very confusing everything I have looked at say it should just work.
I'll report back when I discover the problem.


ryry46d9

One thing I can add is,
when you click on a picture instead of it being larger it downloads it.

not sure if related or even helpful

GL700Wing

Quote from: ryry46d9 on August 30, 2021, 05:07:26 PMfor right now I'm just going to give up, I have a lot of work that needs to get done. in a few weeks I'll come back to it.
It's very confusing everything I have looked at say it should just work.
I'll report back when I discover the problem.
PM sent.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

GL700Wing

Quote from: ryry46d9 on August 30, 2021, 05:07:26 PMfor right now I'm just going to give up, I have a lot of work that needs to get done. in a few weeks I'll come back to it.
It's very confusing everything I have looked at say it should just work.
I'll report back when I discover the problem.
Woot!!  I just found out what's causing the issue on your forum - it's the WYSIWYG editor - if I disable the WYSIWYG editor in my profile on your forum I can insert images inline!

I've actually disabled it on all my forums because it has always been buggy ...

Administration Center » Posts and Topics » Post Settings » Disable WYSIWYG editor

Quote from: shadav on January 04, 2021, 04:27:44 PM... you can use wysiwyg and know that it is buggy and doesn't work correctly.....
unfortunately (if you search wysiwyg in the forums) it's not really fixable and well it's a pos and pita ...

I'll update the next release of the mod so that it disables the WYSIWYG editor when the mod is installed - looks like it's actually been a known issue for at least the last six years: Post and PM Inline Attachments
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

GL700Wing

Uploaded v7.02 - September 01, 2021
o Per ryry46d9 - disable WYSIWYG editor when mod is installed.
o Per @rjen - fixed PHP 7.4 bug.
o Fixed bug introduced in v7.01 which prevented image attachments from expanding if they are inserted with the 'attach' or 'attachmini' options.
o Changed error message for when 'Allow quoted attachment images from another post?' option is disabled from 'You are not allowed to view this attachment' to 'Quoting of attachment images from other messages is not allowed'.
o Made some changes in Post.template.php to ensure consistent font sizing when installed with the Automatic Attachment Rotation (and Resize) mod.
o Other minor bug fixes.


** IMPORTANT NOTE: **
The SMF default WYSIWYG editor will be disabled when this mod is installed because if it is enabled the '(Insert Attachment)' link will not work.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

GL700Wing

Uploaded v7.03 - September 29, 2021
o For print page view: added option to show inline images in the message body, and to show non-inline images and list non-image attachments below the message body.
  o If the 'Remove attachment image under post after inline use' option is not enabled images that are shown in the message body will also be shown below the message body.
  o Note: The Images on Print Page mod MUST be uninstalled before this version is installed as this new feature replaces the functionality it provided in conjunction with enhancements added by earlier versions of this mod.
o Bug fix: Changed renumbering message for "Should first attachment be numbered 1?" from a 'confirmation' message to an 'alert' message because if 'Cancel' was clicked instead of 'OK' for the 'confirmation' message the inline attachment IDs in existing messages were not renumbered resulting in invalid and/or mismatched inline attachment IDs.
o Added 'Download link and counter setting' option to display filename, size and dimensions over three lines.
o Code improvements.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

@rjen

When I choose to renumber the attachments the process starts, then times out, and when restarting it gives e a 404 page... process does not resume/finish from the looks of it...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

Hmm, after that I changed it back to 0 and saved and it seems to now have renumbered a fairly large number of inline attached to -1...

Effectively many inline attachments are now showing the wrong images ... thank god I tried it on a test forum and not on the productive forum. This function is dangerous with this bug in it...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

GL700Wing

#913
Quote from: @rjen on September 29, 2021, 05:03:55 PMHmm, after that I changed it back to 0 and saved and it seems to now have renumbered a fairly large number of inline attached to -1...

Effectively many inline attachments are now showing the wrong images ... thank god I tried it on a test forum and not on the productive forum. This function is dangerous with this bug in it...
Thanks for reporting this - I had tested this but only on a test forum that does not have very many inline attachments.

The renumbering function has been part of this mod for many years (and I didn't actually change the way it works in this release) but previously it displayed a confirmation message (ie, OK or Cancel) and I only discovered recently that if Cancel was clicked it changed the starting number for the 'Insert Attachment' button but did not renumber the attachment tags in existing messages which resulted in the issues you reported in this message.

I'll look into the timeout issue because I believe that's the primary cause of the problem ...
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

GL700Wing

Quote from: @rjen on September 29, 2021, 04:58:02 PMWhen I choose to renumber the attachments the process starts, then times out, and when restarting it gives e a 404 page... process does not resume/finish from the looks of it...
I've been working on this issue since you reported yesterday* and I discovered that the 404 error is caused by a bug in the code that has been there for at least six years (the oldest version of this mod I can find on my computer is v4.1 from August 2015 and the bug was there then).


* Initially I couldn't reproduce this problem using a copy of my largest forum so I had to actually add a whole lot of extra messages containing ILA tags to the messages table ...
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

@rjen

I believe you: I never used the function before, but I tried it because you mentioned making changes to it in this version.

I personally believe in making a choice and sticking to that if there is no reason to change, so I never felt the need to change the numbering...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

GL700Wing

Quote from: @rjen on September 30, 2021, 11:48:42 PMI believe you: I never used the function before, but I tried it because you mentioned making changes to it in this version.
I've only ever used it on test forums it because it was there but I've obviously never hit the processing limits that caused the 404 error before ...

QuoteI personally believe in making a choice and sticking to that if there is no reason to change, so I never felt the need to change the numbering...
Me too - leave well enough alone!

That said, and given that the option to change the numbering scheme is offered, the renumbering function should work otherwise it will corrupt the ILA tags in existing messages.

I've been working on a fix and it's currently working reliably with renumbering ILA tags in more than 8,000 messages in a database that has almost 170,000 messages (the renumbering is now done in batches of 250 messages whereas previously it was all done in one go).
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

GL700Wing

Uploaded v7.04 - October 05, 2021
o Per @rjen - fixed bug that caused a '404' error when renumbering a large number of ILA tags.
o Changed code for renumbering ILA tags so that it now updates the database in batches of 250 modified messages instead of updating the database for all of the modified messages at once.
o Added warning message to 'Should first attachment be numbered 1?' advising that if this mod has previously been installed on a forum saving a change to this setting will cause inline attachment tags in all existing messages to be renumbered so the forum MUST be put into maintenance mode beforehand to ensure new inline attachments are not added to messages until after the renumbering process has finished.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

@rjen

The version in the xml has not been updated: it still states 7.03
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

GL700Wing

Quote from: @rjen on October 05, 2021, 02:35:05 AMThe version in the xml has not been updated: it still states 7.03
Thanks (I was sure I'd checked/updated the XML files) - fixed now.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: