Simple Machines Community Forum

SMF Development => Feature Requests => Topic started by: Dave En Velo on January 23, 2021, 04:12:12 PM

Title: Copy and Paste Images into Posts
Post by: Dave En Velo on January 23, 2021, 04:12:12 PM
I do not claim to be an expert in SMF or its Mods but as far as I can see there is no simple way to Copy an image (or part of an image) and Paste it into SMF.  This is something that has been in Word, Excel and many other applications in Windows forever.  It makes construction of documents with images a trivial exercise. 

As a Post(er) to SMF sites I would like to do the same.  I would like to use a tool of my choice, Photoshop, Paint Snip & Sketch, ... to copy an image (or part of an image) to the Clipboard and Paste it into my Post.  At the moment my best option is to Paste the image into an application, eg Photoshop, then save the file, then upload the file as an attachment, Post my post, view my post and copy the link address of the attachment, modify my post to put the image where I want in the post using IMG tags and the link address.  The resulting post looks fine, although the attachment at the end looks a bit odd.

So I can do what I want with version 2.0.17 and I assume the same is true with 2.1.  However, it is cumbersome to say the least and makes SMF look very, very dated.

I think that SMF desperately needs this functionality but reading these requests for new features I cannot see it arriving anytime soon.  So I have been thinking about what could be done to add this functionality without impacting core SMF or needing a mod.  My suggestion is as follows:


My understanding is that Clipboard access is being, or has been, enabled for most browsers.  So this approach looks possible.  There are security issues but they do not look insurmountable.  Saving files to the Cloud is certainly not rocket science.  This is probably relatively simple code but beyond my current capabilities.

So when a user has Copied an image they wish to put in an SMF Post they click on another tab in their browser and click "Replace Clipboard image with corresponding SMF IMG tags".  When they see DONE they click back to the SMF Post and Paste the IMG tags where the image is required.

The merits of this approach are:

If the approach I am suggesting is as feasible as I suggest then a later enhancement would be to add the "Replace Clipboard image with corresponding SMF IMG tags" button to the Posting page in SMF so that Copy and Paste of images into SMF Posts is truly trivial (as it should be).  Could be a change to core SMF or a mod.

Embellishments to such an approach would be optional re-sizing of images before upload to the Cloud and optional width and height on the IMG tag.

Of course if a "Replace Clipboard image with corresponding SMF IMG tags" cannot be implemented on a web page then a program could be written to do the same thing - although different versions might be required for different platforms.  However, I strongly feel that something needs to be done to plug this glaring hole in SMF functionality.
Title: Re: Copy and Paste Images into Posts
Post by: vbgamer45 on January 23, 2021, 04:37:39 PM
I will work on this for SMF 2.1 as an addon.
Title: Re: Copy and Paste Images into Posts
Post by: Kindred on January 23, 2021, 09:07:12 PM
Well, while it's good to see  vbgamer will work on a mod, I would argue with your statement that this "is a glaring hole in smf " since no communication software that i work with allows a paste if an image from clipboard... and that includes Microsoft's own Teams product.

There is already a mod for in line attachments, and it's standard in 2.1... but paste from clipboard? Nope...  not something that browsers or even social media sites do.

Title: Re: Copy and Paste Images into Posts
Post by: Aleksi "Lex" Kilpinen on January 24, 2021, 06:46:28 AM
I've seen many drag & drop solutions on different platforms, but can't really say I'd remember ever seeing exactly this either.
Word, excel and so on are a different thing all together, as clipboard was originally designed to move data within one closed environment - and in locally run Office programs that is exactly what it is still doing.
Title: Re: Copy and Paste Images into Posts
Post by: vbgamer45 on January 24, 2021, 09:07:40 AM
For 2.1 maybe to look into https://www.sceditor.com/posts/drag-drop-upload-demo/  I was working on this ran into one issue trying to debug javascript.
That copies to imgur but you could save to attachments instead. And there can be copy paste support as I am looking at the code.
Title: Re: Copy and Paste Images into Posts
Post by: Dave En Velo on January 24, 2021, 11:32:33 AM
I have just tried out vbgamer45's drag-drop-upload-demo and it contains the the kind of Copy/Paste functionality that I am looking for.  I Copied part of an image out of Photoshop Elements and Pasted it into a Posting with a few trivial clicks.  I was also able to reverse the process and select an image in the Posting, Copy it and Paste it into Word.

I assume this is a byproduct/feature of demo code to implement drag and drop of image files, certainly Drag and Drop of image files works fine.  I did try to Drag a selected image from Word and Drop it on the Posting but that just resulted in an empty outline in the Posting.  Frankly I was not expecting that to work as I am not sure what I expected.

I am currently a 2.0.17 user and I have been put off attempting to move to 2.1 because I didn't see the benefit to my users and the Release Candidate status was a concern.  However, if Copy/Paste of images is in the editor that's a real driver to upgrading, I will look out for this feature.

Thanks
Title: Re: Copy and Paste Images into Posts
Post by: Kindred on January 24, 2021, 11:53:45 AM
It is unlikely to be a core feature
Title: Re: Copy and Paste Images into Posts
Post by: GigaWatt on January 25, 2021, 01:43:43 PM
Quote from: Kindred on January 23, 2021, 09:07:12 PM
There is already a mod for in line attachments, and it's standard in 2.1... but paste from clipboard? Nope...  not something that browsers or even social media sites do.

FB Messenger does... don't know about FB, haven't tried it.
Title: Re: Copy and Paste Images into Posts
Post by: d3vcho on January 25, 2021, 04:36:13 PM
Quote from: Kindred on January 23, 2021, 09:07:12 PM
There is already a mod for in line attachments, and it's standard in 2.1... but paste from clipboard? Nope...  not something that browsers or even social media sites do.

Yup, this is not true. You can do it in Twitter, WhatsApp, Telegram, Discord... It's a fancy feature and it's very handy for when you take a screenshot and want to send that screenshot without having to save it to your computer. There are some programs that allow you to keep a screenshot in your clipboard, for example, Lightshot.
Title: Re: Copy and Paste Images into Posts
Post by: GigaWatt on January 26, 2021, 11:31:17 AM
Well... seems like that joke about the user that tried to paste an image in a plain txt file isn't going to be funny pretty soon :P :D.