locked
Resize image RRS feed

  • Question

  • User898048251 posted

    I am displaying images from a database using the code below.

    Is there any way I can resize the images before rendering them?

     

    public void showSelectedImage(string strEncodedImage)
        {
            Response.Clear();
            Response.ContentType = "image/jpeg";

            System.Drawing.Image image = retrieveImage(strEncodedImage);
            image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
        }

        private System.Drawing.Image retrieveImage(string strEncodedImage)
        {
            System.Drawing.Image image = null;

            byte[] imageData = Convert.FromBase64String(strEncodedImage);

            MemoryStream memStream = new MemoryStream(imageData);
            image = System.Drawing.Image.FromStream(memStream);

            return image;
        }

    Thursday, September 3, 2009 7:09 AM

All replies

  • User312496708 posted

    yes check this detailed post

    http://aspnet.4guysfromrolla.com/articles/012203-1.aspx

    Thursday, September 3, 2009 7:30 AM
  • User898048251 posted

     Hi,

    I have followed the link you provided, but what would this be in C#?

    Function ThumbnailCallback() as Boolean
        Return False
      End Function

    It is not this :

    public bool ThumbnailCallback()

    {

    return false;

    }

    Thursday, September 3, 2009 11:42 AM