Image Resize Control for Sharepoint


In this article I am showing an Image resize control that can be used in share point. This will be use full if you are loading an image from share point picture library and showing in a web part. This will help you to automatically resize the image with proportional height and width.
  1. First step is to place the ThumbImage.aspx and ThumbImage.aspx.cs file in _layout folder of share point. I have attached the code file for both please have a look at the code.

    1.gif

  2. As the web part accessing the images from picture library you have to give the network credentials to view the images for normal users (I am using anonymous access in the web application, if you are not using you can avoid passing network credentials).

  3. Where you want to resize the image call the below 

    imgLogo.Src =
    @"/_layouts//ThumbImage.aspx?img=" + item["Image _Logo"].ToString().Substring(0, item["Image _Logo "].ToString().IndexOf(","));

  4. Where Image _Logo contains the URL of the image.

Up Next
    Ebook Download
    View all
    Learn
    View all