SharePoint Guru – Uploading (and Resizing) Images to a SharePoint Picture Library via a Webpart

Let's showcase another June TechNet Guru winner!

Matthew Yarlett is our SharePoint TechNet Guru for June! See the TechNet Guru Contributions for June 2013.


Matthew Yarlett's avatar

About Matthew: I'm a solutions architect primarily focused on delivering business solutions built on top of the SharePoint platform. I love getting technical, but I'm equally interested in the business end of IT and deriving value from IT systems.


Here is Matthew's winning article:

Uploading (and Resizing) Images to a SharePoint Picture Library via a Webpart



Here are all the June SharePoint winners:

Guru Award SharePoint 2010 Technical Guru - June 2013 
Gold Award Winner


Matthew Yarlett Uploading (and Resizing) Images to a SharePoint Picture Library via a Webpart Margriet Bruggeman: "Handy to have this code!"
Peter Laker: "Nice article. Who's the mugshot of?"
Ed Price: "It's very clear! It's great how you take us through this, with the code and image for clarity."
Tom Van Gaever: "Please do not set AllowUnsafeUpdate to true"
Silver Award Winner


Sunny Dasgupta SEO Friendly SharePoint Sites/Pages Margriet Bruggeman: "Good to know!"
TVG: "SharePoint 2013 PG has invested a lot in making SharePoint a better WCM solution. I would create a series that lists all the improvements for public facing websites (image rendition, device channels,...)"
Peter Laker: "Top tip"
Ed Price: "Short and sweet! Good use of images! Sunny, I think you ended up with two of the top three because you write well on very important topics!"
Bronze Award Winner


Sunny Dasgupta New! SharePoint 2013: Branding Solutions as an App! Showcase your solutions now! TVG: "I like the showcase idea"
Ed Price: "This is an important business lesson! It would be great to follow this up with technical "how to" examples, with all the details. As I mentioned, you have a good business mind to know what people want to learn about!"


Peter, the mugshot is of Matthew! I've got to admit it... SharePoint was truly an amazing category. First, there were 20 contributions. 20! Can you believe it??? Second, it was an incredibly tough call for our judges. There were so many great contributions, and they are so different. Congrats to Matthew, who maintains the gold medal two months in a row (but it was a close call)! Overall, I just want to say thank you to all the contributors (Sunny, Matthew, Usama, Stefan, Ashish, Gokan, Libin, Mohammad, Suresh, and Joydeep)! It really makes us want to be able to reward you all, because there was so much quality!!! Check out all 20 contributions here.


And here's an excerpt from the article:


The webpart will look like this when it loads;

...and like this after you upload an image (hopefully with a different picture!)

7. In the visual webparts code file, add the following code (the OnClick event and two helper methods for resizing the image). In the uploadFile button's OnClick event, we check a file has been selected, is in the right format, and is within size restrictions, before finally uploading it to a memory stream. Once we have the image as a memory steam, we can resize the image to our required width/height maximums (if the selected image has exceeded our maximums width/height).

Note that elevating permissions, error handling and validation have been omitted to keep the example short.



Read the rest here:

 Uploading (and Resizing) Images to a SharePoint Picture Library via a Webpart


Thanks to Matthew Yarlett for your great contribution to the TechNet Guru contest! You can read about all the June winners here: TechNet Guru Award Winners - June 2013


Also, for the July Guru competition, see TechNet Guru Contributions for July 2013.


Are you a Wiki Ninja?

- User Ed

Comments (1)
  1. Computers Today (part 1 of 6)…/computers-today.aspx


    CS SPOTLIGHT: Girls in computer programming… why it matters!!!…/cs-spotlight-girls-in-computer-programming-why-it-matters.aspx

    Computational Thinking – Videos & Papers by Jeannette Wing…/computational-thinking-videos-amp-papers-by-jeannette-wing.aspx

Comments are closed.

Skip to main content