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

420Connect.co.uk

Quote from: dougiefresh on August 04, 2015, 05:04:36 PM
Quote from: 420connect.info on August 04, 2015, 11:39:12 AM
Does anyone happen to have a copy I could get?  :-[
Here ya go.

Solved since I first posted but thanks anyway Dougie! ;)
www.420Connect.co.uk ~ A Social Network For The #CannabisCommunity ~ Come say "High" ;)

dougiefresh

Quote from: CrescentEclipse on July 31, 2015, 05:23:15 PM
Quote from: dougiefresh on July 24, 2015, 06:35:54 PM
Sure would.  It would make it easier to confirm which image you are wanting to use....  Plus I believe that thumbnails are generated regardless of whether they are shown in a post, but I'd have to dig through the code to make sure....

Okay, now I understand. I think this could be nice to have. But I think thumbnails are not generated if not enabled. Would this work with new attachments, because they are not uploaded at this time?
You are correct.  If the option "Resize images when showing under posts" is unchecked OR the thumbnail width and/or height aren't set (aka: equal to 0), attachment thumbnails are not generated. 

Regarding the mod: If the thumbnail is available, it is used.  Otherwise, the full image is used.

Quote from: CrescentEclipse on July 31, 2015, 05:23:15 PM
Hm, another question not related. Is it possible to make the mod a bit more multilanguage friendly? I want to translate it to german, but "Insert Attachment X" would be "Anhang X einfügen". Is it possible to move this number?
I haven't had time to implement this feature.  It is a bit harder to implement in the code properly because of the fact that a user can inline a just-attached image that hasn't been uploaded yet.  The Javascript code has to take care of that, and I haven't had time to work on the mod in the last few days because of work....

CrescentEclipse

Quote from: dougiefresh on August 07, 2015, 07:50:16 PM
I haven't had time to implement this feature.  It is a bit harder to implement in the code properly because of the fact that a user can inline a just-attached image that hasn't been uploaded yet.  The Javascript code has to take care of that, and I haven't had time to work on the mod in the last few days because of work....

Hm, what about a parameter in the language file like "%n" and then let the js code replace the parameter with the actual number?

aegersz

i have a couple of questions:

does this mod change the way attachments are handled WITHOUT [attachment=n][/attachment] ?

in preview and SimplePortal i get [ You are not allowed to view attachments ] - is that normal or how can i fix that ?
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

dougiefresh

Quote from: CrescentEclipse on August 10, 2015, 07:30:43 AM
Hm, what about a parameter in the language file like "%n" and then let the js code replace the parameter with the actual number?
That is the plan.  However, I haven't gotten around to doing it yet....

Quote from: aegersz on August 10, 2015, 11:47:39 AM
does this mod change the way attachments are handled WITHOUT [attachment=n][/attachment] ?
The only way the code is changed for attachment handling is that the code involved with removing attachments is moved after the code to add attachments.  For some weird reason, the mod doesn't work properly if it is the other way around....

Quote from: aegersz on August 10, 2015, 11:47:39 AM
in preview and SimplePortal i get [ You are not allowed to view attachments ] - is that normal or how can i fix that ?
In preview mode, you must submit the post with the attachment at least once before you can preview it.  It is a known issue that I plan on fixing (if possible).

I need more information about your SimplePortal setup so that I can make an educamakated guess what the problem is.... :P

dougiefresh

Uploaded v3.17 - August 10th, 2015
o Fixed issue with the post preview display of inline attachments.
o Fixed issue with download counter being display with image styles being applied.
o Modified code to make "Inline Attachment" string more language-friendly....

420Connect.co.uk

If I change the setting of starting numbering the attachments as 1 instead of 0, will it update the old '0' ones?
www.420Connect.co.uk ~ A Social Network For The #CannabisCommunity ~ Come say "High" ;)

dougiefresh

Quote from: 420Connect.co.uk on August 11, 2015, 03:07:30 PM
If I change the setting of starting numbering the attachments as 1 instead of 0, will it update the old '0' ones?
No.  There are no plans (at the moment) to change this.  It would involve changing every other ILA tag so that the numbering scheme remains the same (aka: 2 refers to the same attachment that 1 does), and across multiple messages, that can get very time-consuming....

dougiefresh

Quote from: dougiefresh on August 11, 2015, 04:40:49 PM
Quote from: 420Connect.co.uk on August 11, 2015, 03:07:30 PM
If I change the setting of starting numbering the attachments as 1 instead of 0, will it update the old '0' ones?
No.  There are no plans (at the moment) to change this.  It would involve changing every other ILA tag so that the numbering scheme remains the same (aka: 2 refers to the same attachment that 1 does), and across multiple messages, that can get very time-consuming....
I thought about it some more.  Yes, it can be done.....  Lemme see how hard it would be to implement....  I still have to work through Thursday, and my wife and I have stuff planned for Friday.  My computer is also getting repaired this weekend (Fri/Sat), so it may not be this week....

420Connect.co.uk

Quote from: dougiefresh on August 11, 2015, 07:34:08 PM
Quote from: dougiefresh on August 11, 2015, 04:40:49 PM
Quote from: 420Connect.co.uk on August 11, 2015, 03:07:30 PM
If I change the setting of starting numbering the attachments as 1 instead of 0, will it update the old '0' ones?
No.  There are no plans (at the moment) to change this.  It would involve changing every other ILA tag so that the numbering scheme remains the same (aka: 2 refers to the same attachment that 1 does), and across multiple messages, that can get very time-consuming....
I thought about it some more.  Yes, it can be done.....  Lemme see how hard it would be to implement....  I still have to work through Thursday, and my wife and I have stuff planned for Friday.  My computer is also getting repaired this weekend (Fri/Sat), so it may not be this week....

Awesome stuff! Take all the time you need buddy and thank you very, very much!  :laugh:  O:)
www.420Connect.co.uk ~ A Social Network For The #CannabisCommunity ~ Come say "High" ;)

brynn

Hello again,
I'm not sure if I have the settings wrong, or if the mod doesn't handle SVG, PDF, or TXT files.

Please look at this message on the test board of my forum:  http://forum.inkscapecommunity.com/index.php?topic=249.msg1841#msg1841

For my forum, it's important to be able to attach SVG files (as well as PDF and a few others).  They all work fine as regular attachments.

Or do I have the settings wrong?

Thanks for  your help  :)

dougiefresh

Quote from: brynn on August 15, 2015, 02:48:10 PM
I'm not sure if I have the settings wrong, or if the mod doesn't handle SVG, PDF, or TXT files.
The mod doesn't handle anything other than standard images.  SVG files are NOT handled properly within SMF, though....  nor are they properly displayed as an image when they are attached to a post.  It might be possible to display it as an image, though....  Let me do some changes to see if I can properly display attached SVG files in this mod....

The mod doesn't display the contents of TXT files at this time.  If I were to add that feature, I assume that the contents of the TXT file would be displayed as part of the text?  Any special styling needed?  More info is necessary....

The mod doesn't display PDF files at this time, either.  Modifications might be able to be made to support displaying them....

brynn

Quote from: dougiefresh on August 15, 2015, 03:19:47 PM
.....  SVG files are NOT handled properly within SMF, though....  nor are they properly displayed as an image when they are attached to a post.  It might be possible to display it as an image, though....  Let me do some changes to see if I can properly display attached SVG files in this mod....

Hhmm, we haven't had any problems displaying SVG images in my SMF 2.0.1 forum.  (Or previously going back to 1.0.7)

Here's one embedded:  http://forum.inkscapecommunity.com/index.php?topic=87.msg698#msg698

And here's an attachment (regular, not inline):  http://forum.inkscapecommunity.com/index.php?topic=87.msg999#msg999 (notice it's under the PNG)

I don't know about technical specifications of "properly displayed", but those do the job for us just fine.

You can see that e mbedded, the image is dislayed.  And attached, the link allows the file to be downloaded.  A download link would be fine with me, for inline attachment.  But displaying the image would be a big plus!  (I know that phpBB forums don't display the SVG inline, but only the download link.)

I don't think I've tried to attach or embed a PDF.....  Maybe, but I can't put my finger on it, to show.

Thanks for the info about support of PDF and TXT files.  I don't know if TXT file would ever be used, but I was just trying to think of some regular type of files that I might expect should work.  To be honest, I've never tried to attach a TXT file with regular attachment anyway.

I guess the main comment I would make, is that to be able to use this mod on a professional kind of forum, I would expect it to handle the same kind of files that regular attachments can handle.  And I'm certainly looking forward to seeing this mod in its fully fledged version!  :)

(By the way, I noticed that you made the inline attachment so they show in the post preview.  Thank you very much!!)

dougiefresh

I've managed to get attached SVG files to show up correctly within posts.  It took a bit of work to figure out how it should be done.  For me, the real kicker was when you show me a post with a SVG shown within it.  Seeing how you managed to display a SVG file like that got me thinking how it could be done similarly....  So when the SVG files get pulled as an attachment, the proper mime type gets returned as well, enabling the browser to know what/how it should display....

I've also managed to get attached TXT files to display embedded in posts....  There is no security risk to doing so, as the HTML special characters (<, >, etc, etc) are converted so that they aren't mistaken by the browser as HTML tags...

Quote from: 420Connect.co.uk on August 11, 2015, 03:07:30 PM
If I change the setting of starting numbering the attachments as 1 instead of 0, will it update the old '0' ones?
I've got a beta almost ready with this feature implemented.  It still needs some serious testing, but it is supposed to pause every 5 seconds to report that it is still working on adjusting the ILA tags.  I was thinking that the mod should put the forum into maintenance mode temporarily, to minimize the mess that the user might see....  A word of caution with the beta:  If you uncheck the "1-based numbering" option and have a [attachment id=0], you will probably end up with this: [attachment id=-1]....

brynn



I didn't do any managing, of my own.  Afaik, all SMF forums should be able to display SVG images.  The SVG image has to be uploaded to the internet, of course, just like any image.  And just put the URL in the img tag.

Making attached SVG file display as an image, afaik, would put SMF ahead of other types of forums.  As I mentioned, I know that phpBB doesn't display the image (for attached SVGs).  And neither does SMF, for that matter, for regular attachments!

Anyway, thanks for your work!

dougiefresh

#375
Attached v3.18 Beta 1 - August 16th, 2015
o Seperated admin functions from general bbcode functions and placed in new file.
o Added support for SVG files as inline attachments.
o Added support for TXT files as inline attachments.
o Added support for PDF files as inline attachments.  (Not verified as working yet...)
o Added options to enable ILA support for SVG, TXT and PDF files.
o Added code to adjust the inline attachment IDs when "one-based numbering" option is changed.
o Reorganized ILA options so that their organization makes more sense (at least to me).
o Added default video width and height options.  (Set by default to 640x400)
o Made "Highslide" option visible, but disabled when no supported Highslide mods are installed.
o Made "EXIF" option visible, but disabled when EXIF mod isn't installed.




@Everybody: I need anyone willing to do some testing of the inline attachment ID adjustment code when the "one-based numbering" option is changed....  This beta should not only adjust ILA tags within regular posts, but PMs as well....  PLEASE do not do this testing in a production environment, as there may be issues with the new admin functions of this mod....  I haven't seen any yet, but I don't have a large database filled with ILA tags, either....

Remember, if you want to check the new functionality with SVG or TXT files, make sure you check the appropriate options before testing!

Quote from: brynn on August 16, 2015, 12:18:34 PM
Making attached SVG file display as an image, afaik, would put SMF ahead of other types of forums.  As I mentioned, I know that phpBB doesn't display the image (for attached SVGs).  And neither does SMF, for that matter, for regular attachments!
This gives me an idea for yet another mod....

dougiefresh

v3.18 Beta 1 doesn't work properly.  The "one-based numbering" adjustment code isn't written quite right, as it takes the parameters to continue its' work from the post data, but passes them via the URL....  :o

Antes


brynn

Hhmm....I thought I read in this thread (a page or 2 back) that you made the post preview to show the image, in 3.18.  I installed 3.18, but it's still not showing the attached image in post preview.  I still see the error message.

Maybe I misunderstood?

dougiefresh

Quote from: brynn on August 18, 2015, 12:14:27 PM
Hhmm....I thought I read in this thread (a page or 2 back) that you made the post preview to show the image, in 3.18.  I installed 3.18, but it's still not showing the attached image in post preview.  I still see the error message.
You must still upload the attachment to the server at least once before it can be displayed as an inline attachment.  This issue is known and has not been fixed yet.  Have you uploaded the attachment before attempting to preview the post?  (Pressing preview instead of save does not count!)

Advertisement: