Advertisement:

Author Topic: Copy and Paste Images into Posts  (Read 5350 times)

Offline Dave En Velo

  • Semi-Newbie
  • *
  • Posts: 23
Copy and Paste Images into Posts
« 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:

  • Create a web page with a single button marked "Replace Clipboard image with corresponding SMF IMG tags".
  • When the button is clicked the web page accesses the Clipboard and saves the image out in the Cloud and records the URL
  • When the save is complete the web page rewrites the Clipboard with the URL between IMG tags and returns DONE to the user.

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:
  • Copy and Paste of images into SMF Posts is relatively quick and straightforward.
  • Images (unlike those in attachments) are not stored on the SMF site but in an area managed by the user.
  • An initial implementation might use the user's Dropbox or Google Cloud but this could be configurable so that any cloud provider could be used.
  • No changes to SMF, no mod required.

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.

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,608
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Copy and Paste Images into Posts
« Reply #1 on: January 23, 2021, 04:37:39 PM »
I will work on this for SMF 2.1 as an addon.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Kindred

  • The Mean One
  • Lead Support Specialist
  • SMF Legend
  • *
  • Posts: 60,427
  • Gender: Male
    • Kindred-999 on GitHub
Re: Copy and Paste Images into Posts
« Reply #2 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.

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Project Manager
  • SMF Super Hero
  • *
  • Posts: 20,364
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • Aleksi Kilpinen
Re: Copy and Paste Images into Posts
« Reply #3 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.
A Finnish Project Manager (Support Specialist)
Happily running multiple SMF 2.x installations.
 Fooling around with an i7-10700 @ 2,90GHz-4.80GHz / 16Gb / RTX-2070 Super / 3840x2160 / Win 10 x64


How you can help SMF

"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

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 23,608
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Copy and Paste Images into Posts
« Reply #4 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.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Dave En Velo

  • Semi-Newbie
  • *
  • Posts: 23
Re: Copy and Paste Images into Posts
« Reply #5 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

Offline Kindred

  • The Mean One
  • Lead Support Specialist
  • SMF Legend
  • *
  • Posts: 60,427
  • Gender: Male
    • Kindred-999 on GitHub
Re: Copy and Paste Images into Posts
« Reply #6 on: January 24, 2021, 11:53:45 AM »
It is unlikely to be a core feature
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Offline GigaWatt

  • The Smiley Guy
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,346
  • Gender: Male
    • MechDR on GitHub
    • Macedonian electronics forum
Re: Copy and Paste Images into Posts
« Reply #7 on: January 25, 2021, 01:43:43 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.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Offline d3vcho

  • Sempiterno
  • On Hiatus
  • SMF Hero
  • *
  • Posts: 4,786
  • Gender: Male
    • frandominguez03 on GitHub
Re: Copy and Paste Images into Posts
« Reply #8 on: January 25, 2021, 04:36:13 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.
"Greeting Death as an old friend, they departed this life as equals"

Offline GigaWatt

  • The Smiley Guy
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,346
  • Gender: Male
    • MechDR on GitHub
    • Macedonian electronics forum
Re: Copy and Paste Images into Posts
« Reply #9 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.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."