News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Post and PM Inline Attachments

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

Previous topic - Next topic

brynn

Oooohh, Ok I understand now.

Then I will patiently wait  :)

At least we can see that the attachment is in the right place, until it's fixed.

Thanks again  :D

dougiefresh

My advice would be to write your post, attach your files, then submit the post.  Once it has been submitted, then go back and edit it to adjust the position and/or size of the inline attachment to your specifications.  Previewing the post AT THAT POINT should work....  If it doesn't, let me know.  (I just worked a 12-hour shift and don't feel like looking at or testing the code tonight  :P )

brynn

Hi Dougiefresh,
Yes, that works.  But something else came up.

I'm not sure if this is how it's supposed to work or not.  I tried to place 4 small photos, side by side on the same line.  They all have the same height, but different widths.  (I wasn't sure if they would all fit on 1 line, but I thought at least 2 or 3 should fit.)

Here's the test/example on my forum:  http://forum.inkscapecommunity.com/index.php?topic=271.0

I can't explain technically what's going on.  But it looks like somehow the download link and info is getting separated from the image.

What I expected was that the 2nd image would be just to the right of the 1st image, and the download link and info is below each image.  Instead the 2nd image is just to the right of the link and info text of the 1st image.  And that's fine.  But somehow the link and info text of the 1st image is some distance below the 1st image (and that distance is exactly the height of the 2nd image).

(It seems like the 2nd image is trying to be in between the 1st image and the link and info text of the 1st image.)

Anyway, there's no rush on this.  I'm just reporting it, in case it's a bug.  Or if it's not a bug, just to find out if it's the correct way it's supposed to work.



Unrelated to this issue, but related to this mod -- I use another mod on my forum, SMF Articles.  For the most part, its editor is identical to the forum editor (and also, the PM editor is the same thing).  (Maybe not completely identical, technically.  But generally for the user, they're the same.)

Anyway, any chance of seeing Inline Attachments for SMF Articles?  Someday?

dougiefresh

Quote from: brynn on August 20, 2015, 06:55:55 PM
Yes, that works.
Good to hear!

Quote from: brynn on August 20, 2015, 06:55:55 PM
I'm not sure if this is how it's supposed to work or not.  I tried to place 4 small photos, side by side on the same line.  They all have the same height, but different widths.  (I wasn't sure if they would all fit on 1 line, but I thought at least 2 or 3 should fit.)

Here's the test/example on my forum:  http://forum.inkscapecommunity.com/index.php?topic=271.0

I can't explain technically what's going on.  But it looks like somehow the download link and info is getting separated from the image.

What I expected was that the 2nd image would be just to the right of the 1st image, and the download link and info is below each image.  Instead the 2nd image is just to the right of the link and info text of the 1st image.  And that's fine.  But somehow the link and info text of the 1st image is some distance below the 1st image (and that distance is exactly the height of the 2nd image).

(It seems like the 2nd image is trying to be in between the 1st image and the link and info text of the 1st image.)

Anyway, there's no rush on this.  I'm just reporting it, in case it's a bug.  Or if it's not a bug, just to find out if it's the correct way it's supposed to work.
Hmmm.... Let me look into this tomorrow.  I worked another 12 hour shift at my workplace and am feeling barely here enough to try to respond  :P

Quote from: brynn on August 20, 2015, 06:55:55 PM
Unrelated to this issue, but related to this mod -- I use another mod on my forum, SMF Articles.  For the most part, its editor is identical to the forum editor (and also, the PM editor is the same thing).  (Maybe not completely identical, technically.  But generally for the user, they're the same.)

Anyway, any chance of seeing Inline Attachments for SMF Articles?  Someday?
I would have to say "probably not" to this request.  If it used the regular attachments table, then definitely yes, I could make the ILA mod work with the SMF Articles mod.  Since the mod doesn't use the SMF attachment table and doesn't store the same amount of information about the attachments that SMF's attachment table does, it would be difficult to write code without having to do additional parsing of the article attachment in order to get that info...  Not impossible, but difficult...  However, I may be overthinking this since I'm tired....

CrescentEclipse

@dougie
Hm, the image and download link misplacing could be a result of the missing div container to group them together?

dougiefresh

#385
@brynn: In order to get them on a single line, they all need to be floated to the left.  For example:
[attachment id=0 float=left msg=17]   [attachment id=1 float=left msg=17]   [attachment id=2 float=left msg=17]   [attachment id=3 float=left msg=17]
would result in the attached image using the pictures specified:
.

Now, I've made some further changes to the unpublished copy of the mod so that it is an option to output something like this:

I assume that the second one is what you're going for.....

Now, if you wanted a specific amount of space around the image, use the margin parameter.
[attachment id=0 float=left margin=5 msg=17]   [attachment id=1 float=left margin=5 msg=17]   [attachment id=2 float=left margin=5 msg=17]   [attachment id=3 float=left margin=5 msg=17]
This would give you something like this:





@CrescentEllipse: I don't know if I could write something else to make it display properly.....

dougiefresh

@brynn: I forgot to mention that if you turn off the download count option, the pictures will line up correctly without using the float option....  Otherwise, you will need to use the float option....

brynn

For my own use, I don't know that a margin is needed.  Either way meets my expectations.

Could the image size, dimensions, viewed info go below the download link/file name?  Like on a 2nd line of text, underneath each image?

If not, I'm still happy.  Just asking :)

Quote from: dougiefresh on August 21, 2015, 08:40:42 PM
@brynn: I forgot to mention that if you turn off the download count option, the pictures will line up correctly without using the float option....  Otherwise, you will need to use the float option....

First, I should say that I don't understand the code.

Is this float option something the user chooses when they attach the images?  Or is it an option for the admin?

If the user had the option not to show the download link, maybe the new float code would not be needed?

I keep the download option enabled, because we often use attachments to share SVG files.  Otherwise, the download isn't needed.  Although that's just me and my forum.  I can't speak for all, of course.

CrescentEclipse

These are normal options every user can use by just adding them to the tag he/she inserts.
When an user does not want the download count, he/she just uses "attachmini" instead of "attachment".

You can change the standard tag in the admin settings to attachmini, if you want it.
You even can disable the download count for ILAs in the settings. This does not affect the download link of normal attachments under the post (which are not used as ILAs).

brynn

QuoteThese are normal options every user can use by just adding them to the tag he/she inserts.
When an user does not want the download count, he/she just uses "attachmini" instead of "attachment".

Well I can make a little faq for my forum, so people know how to use it (now that I know how).  But maybe it would be nice to have that little hint, along with any other special codes that can be used, where the user can see it when they make the attachment.

Or is it showing somewhere and I just haven't found it?

brynn

Ooohh..... :o 

I just noticed my smf error log has grown very large, in a very short amount of time.  It all seems to be coming from this mod, whenever a visitor looks at a message where this mod was used to attach something.

I'm not sure what kind of info to provide for you -- not sure what you might need  and also not sure how much is safe to show in public.

A lot of them say Line 802, and a lot of others say Line 746.  It looks like it changed from 746 to 802 when I upgraded from whatever I had before to 3.18.

Does that help?  Sure would not like this for the long term   ???

dougiefresh

#391
Quote from: brynn on August 22, 2015, 02:10:06 AM
Could the image size, dimensions, viewed info go below the download link/file name?  Like on a 2nd line of text, underneath each image?
I added a total of 6 options to the download count setting.  This is the Filename, Size, Dimensions and Count (3 Lines) setting.  What do you think?

Btw, the dog image has 40% opacity because on my test forum, it is an unapproved image.  Such images can only be seen by admin, moderators and the post author....  Everybody else gets the "This attachment hasn't been approved" message when viewing such a post....

Quote from: brynn on August 22, 2015, 06:58:11 AM
But maybe it would be nice to have that little hint, along with any other special codes that can be used, where the user can see it when they make the attachment.
I agree....  It would be nice....  Probably hard to code, though....

Quote from: brynn on August 22, 2015, 06:58:11 AM
Or is it showing somewhere and I just haven't found it?
Nope, such a "hint" isn't included in the mod.

Quote from: brynn on August 22, 2015, 07:10:49 AM
I just noticed my smf error log has grown very large, in a very short amount of time.  It all seems to be coming from this mod, whenever a visitor looks at a message where this mod was used to attach something.
The latest version of the mod isn't expressing an errors, so hopefully I've already solved the issue with the unpublished version....

420Connect.co.uk

Quote from: dougiefresh on August 17, 2015, 08:03:16 PM
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

Sorry to be a pest, but I wondered if you had got around to having another look into this?
www.420Connect.co.uk ~ A Social Network For The #CannabisCommunity ~ Come say "High" ;)

dougiefresh

Sorry.  It's been a busy last 2 days, and aside from dealing with the two issues that I've mentioned already, I haven't accomplished much of anything on the mods....

brynn

QuoteWhat do you think?

That looks fantastic!

QuoteThe latest version of the mod isn't expressing an errors, so hopefully I've already solved the issue with the unpublished version....

Awesome!  Looking forward to it  :)

New problem  (I have 3.17 installed)
In PM attachment, here is a screenshot of what I see after attaching an image to a PM and before sending....errr, well, it's pmattach.png.  No way to clear attachment, no way to place inline.

Next screenshot is what happens when I try to preview the PM (testattachpre.png).  Says "fatal error...."  However, the message can be sent with attachment intact....just not inline.

No rush.  Just letting you know  :)

CrescentEclipse

Confirmed. Same problem here in normal posts (not PMs). The page stops loading at the position where the first insert link should be.

The function should be sprintf not sprint. I modified the code and this works for me. I also changed the links to buttons, looks more intuitive to me. The class "btn btn-primary btn-sm" can be ignored / deleted, this is only because my SMF style uses bootstrap framework. I attached the file, maybe it is helpful ;)

v3.17 mod

LG Cres

dougiefresh

Quote from: dougiefresh on August 22, 2015, 09:40:04 AM
Quote from: brynn on August 22, 2015, 06:58:11 AM
But maybe it would be nice to have that little hint, along with any other special codes that can be used, where the user can see it when they make the attachment.
I agree....  It would be nice....  Probably hard to code, though....
I found some information about creating a inline pop-up window when a button is pressed....  Doesn't look particularly hard to implement using JQuery....  I'll see what I can do about implementing it for the next version....

Quote from: CrescentEclipse on August 24, 2015, 06:49:00 AM
The function should be sprintf not sprint. I modified the code and this works for me.
Fixed for the next version....

Quote from: CrescentEclipse on August 24, 2015, 06:49:00 AM
I also changed the links to buttons, looks more intuitive to me. The class "btn btn-primary btn-sm" can be ignored / deleted, this is only because my SMF style uses bootstrap framework.  I attached the file, maybe it is helpful ;)
I did one of the changed operations manually and I'm kinda undecided on this particular issue at this moment....  Although it probably would make implementing the inline pop-up window easier....

dougiefresh

#397
Uploaded v4.0 - August 28th, 2015
o Added code to adjust the inline attachment IDs when "one-based numbering" option is changed.
o For post author, admin and moderators, unapproved image attachments are shown as partly transparent.
o Fixed issue with links in ILA download info not being formed correctly.
o Fixed issue with ILA download info not showing the original image size correctly.
o Seperated admin functions from general bbcode functions and placed in new file.
o Reorganized ILA options so that their organization makes more sense (at least to me).
o Revised the video playing code so that hopefully it works better now.
o Added default video width and height options.  Defaults to 640x400.
o Added support for SVG files as inline attachments and option to enable it.
o Added support for TXT files as inline attachments and option to enable it.  Inserts as part of post.
o Added support for PDF files as inline attachments and option to enable it.  Defaults to 500x600.
o Added option to control unapproved image opacity percentage.  0 returns "unapproved" message.
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.
o Modified install code so that only mod settings that aren't already set are set.




Changes to the Video code: Version 3.x used strictly HTML5 to try to show video to the users.  Version 4.x uses HTML5 plus Flash fallback to attempt to show video to users.  You will NEED to attach a MP4 AND OGV file to the post.  This mod does not convert MP4/OGV/WebM formats to any other format!!!  You may also post a JPG or PNG as the screenpost of the video.  They must all be named the same, including case-sensitivity.  In other words, Video.mp4, Video.ogv and Video.png must all be attached to the same post.  If the video cannot be shown using HTML5, it will attempt to fall back to using the flash-based JW Player in order to show the video.

Regarding Popups & Buttons:  Nothing has been done on these issues.  They will probably make an appearance next version....

Screenshots: A new screenshot of the Settings page has been attached on the mod page.

RSI

Doug,

Have you had the chance to try it on v2.1b2 yet?

I just did and it crashes the posting page.

I haven't been on here in a while and just installed the new beta and was playing around with it.

dougiefresh

Uploaded v4.1 - August 29th, 2015
o Added option to switch between using HTML5 video tags with flash fallback and using flash only.
o Fixed minor issue where the forum crashes on the Post page.
o Fixed install-time error in add_remove_hooks.php when .htaccess doesn't exist.




@RSI:  Whoops!  I've fixed it for this version.  Thank you for pointing that one out!

Advertisement: