News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Post and PM Inline Attachments

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

Previous topic - Next topic

GL700Wing

Quote from: Gryzor on February 17, 2018, 01:16:22 PM
Thanks for the update!

Unfortunately, for me clicking on "Insert Attachment" still does nothing :(

2.0.15...
In posts or PMs?
Life doesn't have to be perfect to be wonderful ...

Gryzor

Sorry, posts. I don't use it with PMs.

dougiefresh

@Gryzor:  GAAAH!!!!  I knew I forgot something.....

GL700Wing

Quote from: dougiefresh on February 17, 2018, 06:04:49 PM
@Gryzor:  GAAAH!!!!  I knew I forgot something.....
I'm wondering if @Gryzor has a conflicting mod that is blocking the 'Insert Attachment' functionality - I have this mod installed on an SMF 2.0.15 forum that has 135 mods (plus a lot of other customisation) and it's working properly.
Life doesn't have to be perfect to be wonderful ...

dougiefresh

Just tested version 6.4 on a pretty clean localhost forum.  Works fine for me as well!

GL700Wing

Quote from: dougiefresh on February 17, 2018, 11:25:15 AM
@GL700Wing:  I just can't keep up with everything lately....  Thank you for sharing your fixes!  They have been included in this version!
Should have mentioned there were two place in install_20x.xml that needed the following change (one for Post.template.php and one for PersonalMessage.template.php).

The following code change in install_20x.xml adds a space to each side of 'ila_tag' which allows consecutive inline images to wrap as required when displayed.
Find:
$(smfmod_editor).data(\'sceditor\').insertText(\'[' . $ila_tag . ']\');' : '
replaceText(\'[' . $ila_tag . ']\', document.forms.postmodify.' . $context['post_box_name'] . ');'), '


Replace with:
$(smfmod_editor).data(\'sceditor\').insertText(\' [' . $ila_tag . '] \');' : '
replaceText(\' [' . $ila_tag . '] \', document.forms.postmodify.' . $context['post_box_name'] . ');'), '
Life doesn't have to be perfect to be wonderful ...

Gryzor

Hm, so maybe it's something else... but, any idea how to troubleshoot it? Any ideas? Used to work just fine up to (I think) 6.2 or so...

Thanks for the mod and updates, btw :)

GL700Wing

Quote from: Gryzor on February 18, 2018, 02:39:06 AM
Hm, so maybe it's something else... but, any idea how to troubleshoot it? Any ideas? Used to work just fine up to (I think) 6.2 or so...
I suspect it's caused by a JavaScript conflict - can you post a list of the mods you have installed?

Also, do you know if auto-suggest is working? For example: when composing a PM and once you've typed three characters in the 'To' field you should see a list of possible matches displayed that you can select from.  Some years ago auto-suggest stopped working on my forum and it was caused by some issue in the JavaScript code of a mod I'd installed - as soon as I removed the mod auto-suggest started working again.
Life doesn't have to be perfect to be wonderful ...

Gryzor

That sounded like a good suggestion. Autocomplete works fine in my case though...

Here's my list of mods; this time I've kept it rather light :D

1.Mod NameVersion1.Enhancements to purge inactive members1.3.6 
2.Sorted Package Manager Listing1.2 
3.SEO Sitemap2.2.1 
4.RSS Feed Icon1.1 
5.Gravatar 4 SMF1.1 
6.SA Chat1.0a1 Rev120 
7.Bookmarks2.5 
8.Akismet Spam Blocking2.0 
9.Tapatalk SMF 2.0 Plugin4.4.1 
10.Post and PM Inline Attachments6.4 
11.SMFPacks Alerts Pro2.0.14 
12.Simple Off-Topic BBC1.0 
13.Pretty URLs1.1.4 
14.Recent Topics On Board Index1.03 
15.SMFPacks Mentions1.4.4 
16.Treasury2.12 
17.Expanding & Collapsing Spoiler Tag3.2 
18.SMFPacks Likes Pro Mod2.0.7 
19.WYSIWYG Quick Reply2.3 
20.SMF 2.0.15 Update1.0 
21.SMFPacks Media Embedder1.0.3 
22.Google Analytics Code1.5.1 
23.SMF Downloads Directory1.2.3 
24.Country Flags3.0 


jakes_t

Working nicely for me now on this version. All the bugs I reported are no longer an issue  :)

Diadu

I've tried out the mod today. At first glance it seemed to work fine for me. The images appear, as expected, inside the posts.

The problem I am facing is when one clicks on the images or the download link itself. Clicking on either redirects me to the URL of the attachment with an error:

http ://*/index.php?action=dlattach;topic=14.0;attach=20
Fatal error: Call to undefined function mime_content_type() in /home/*/*/Sources/Subs-InlineAttachments.php on line 1094

I've tested this with existing and new attachments. In both cases the image is displayed fine but the link to the attachment will redirect me to the error mentioned above.

I've tried this by first installing the suggested mod for inline attachments in PMs, I've tried it without the suggested mod. All links lead to the same error.

Any suggestions?

dougiefresh

Uploaded v6.5 - March 1st, 2018
o Fixed error relating to unavailable mime_content_type function.
o Added fallback code to use finfo_file when mime_content_type isn't available.




@Diadu:  Thanks for the bug report!  ::) The mod call a function that wasn't available, knowing it wasn't available....  Kinda stupid, if you ask me!   O:)  Anyways, it's been fixed for this version!

Diadu

Quote from: dougiefresh on March 01, 2018, 11:48:45 AM
Uploaded v6.5 - March 1st, 2018
o Fixed error relating to unavailable mime_content_type function.
o Added fallback code to use finfo_file when mime_content_type isn't available.




@Diadu:  Thanks for the bug report!  ::) The mod call a function that wasn't available, knowing it wasn't available....  Kinda stupid, if you ask me!   O:)  Anyways, it's been fixed for this version!

Thanks! I tried out the new version and uploaded an attachment and clicking on the image or the link now initiates a download, excellent. It looks like it didn't fix any of the old attachments, but luckily the forum I made is pretty new so there weren't many attachments.

Something else I have noticed is that if you disable the download link for a file in the settings, any text added after the attachment will be turned into a link. I attached two images. The first one is with the download link enabled. The second image is with the download link disabled and the text turned into a link. I hope it makes sense lol

Edit: Also happens when I use the attachmini tag because that omits the download link

dougiefresh

@Diadu: I'll look further into these reports!

@Everybody Else:  If you have reported the same issues as Diadu, I apologize for not looking into these reports earlier!

lwiz

First of all big thank you for plug in replacement for the aging smf-ila!

On Postgres there was a slight problem with query from query in Sources/Subs-InlineAttachmentsAdmin.php:

Tietokantavirhe: ERROR: column "%[attach%" does not exist
LINE 4: WHERE body LIKE "%[attach%"
^

SELECT COUNT(*) AS count
FROM verstas_messages
WHERE body LIKE "%[attach%" Tiedosto: Sources/Subs-InlineAttachmentsAdmin.php
Rivi: 219


I fixed this changing the delimiters next to %[attach% into 's and changing the query delimiters to "s - MySQL is I believe agnostic with using 's or "s whereas Postgres is far more strict.

I ended up with following code in the query:

                // Get the number of post/PMs that have an ILA tag within it:^M
                $request = $smcFunc['db_query']('', "
                        SELECT COUNT(*) AS count
                        FROM {db_prefix}" . $table . "
                        WHERE body LIKE '%[attach%'",
                        array()
                );

dougiefresh

@lwiz:  Thanks for reporting this!  Do me a favor and replace your code with this fragment:

// Get the number of post/PMs that have an ILA tag within it:
$request = $smcFunc['db_query']('', '
SELECT COUNT(*) AS count
FROM {db_prefix}' . $table . '
WHERE body LIKE {string:body}',
array(
'body' => '%[attach%',
)
);

Let me know if it works any better for you!

lwiz

Works without a hitch, thank you!

BTW, I wrote finnish-utf8 userguide and probably will get the admin part done during the weekend. I'll happily donate those if they are of any use for you?

-L

dougiefresh

Thanks!  It'll be part of the next version!  Sure, translations are always welcome!

dougiefresh

Quote from: Diadu on March 01, 2018, 12:20:23 PM
Thanks! I tried out the new version and uploaded an attachment and clicking on the image or the link now initiates a download, excellent. It looks like it didn't fix any of the old attachments, but luckily the forum I made is pretty new so there weren't many attachments.

Something else I have noticed is that if you disable the download link for a file in the settings, any text added after the attachment will be turned into a link. I attached two images. The first one is with the download link enabled. The second image is with the download link disabled and the text turned into a link. I hope it makes sense lol

Edit: Also happens when I use the attachmini tag because that omits the download link
Both issues are fixed.

dougiefresh

Uploaded v6.6 - March 4th, 2018
o Made changes to admin tag adjustment code for better Postgres compatibility.
o Fixed an issue where text after inline attachment was a hyperlink.

Advertisement: