wiliammbr's blog

Some thoughts on SharePoint and other random stuff

Copying and Pasting images to your SharePoint Pages

One thing that I had to face and discuss at least once a month among Clients requests was: an easy way to paste images into SharePoint pages. Although my automatic answer was always “Just upload it through the ribbon, so you can tag and ensure the content quality”, I have to admit this way isn’t THAT user-friendly.

That’s why I decided to develop some JavaScript code to add this functionality to my Web Pages, so the users could be able to add their images faster. Basically, I’ve created a GitHub repository to keep the code, so maybe someone can help me on refactoring it or adding support for others browsers.

https://github.com/wiliammbr/sp-copypasteimages

The project is a SharePoint provider-hosted app that publishes some JavaScript files to your Site Assets library. It was based on some SharePoint projects in the PnP – Patterns and Practices, hosted by Microsoft. Also, it will add ScriptLinks to insert those script files into your pages. In my example, the app was hosted in an Azure Cloud Service.


But if your prefer, it’s possible to add those scripts into your Master Page files, so you don’t need the Provider-hosted App approach.

The functionality will be installed and attached to the Body fields on your pages. So you can just copy an image from your photo viewer or editor.

And then, just paste it on the body of your Page:

The end result should look like this:

References:
THE DEFINITIVE GUIDE TO COPYING AND PASTING IN JAVASCRIPT
SharePoint – PnP – Patterns and Practices

1 Comment

  1. Sugoi

Comments are closed.

© 2017 wiliammbr's blog

Theme by Anders NorenUp ↑