MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Thumb Nail Image Scenario

  Asked By: Carlos    Date: Apr 19    Category: MOSS    Views: 1448

Scenario: Need to create a web part in MOSS 2007 for displaying thumbnail images
which exist in user profile related lists.

Current approach: I have created a user control to render images and called
inside a web part. The following objects are used to display images in a user

Below code works fine when I used in webapplication but its displaying the image
in the form of bytes in webpart.

Please find the rendered image in webpart.

The complete code set along with the image is in the word document.Any help
would be greatly appreciated thanks.

WebClient httpRequest = new WebClient(); -- used for requesting a remote image

BinaryReader rdr = new
ticleimage.jpg")); -- used for reading the image object

byte[] imageArray = ConvertStreamToByteArray(rdr.BaseStream); -- converting to
byte stream.

System.IO.MemoryStream strm = new System.IO.MemoryStream(imageArray); --
converting to memory stream

System.Drawing.Image image = System.Drawing.Image.FromStream(strm); -- reading
the stream in the form of image object

System.Drawing.Image thumbnailImage = image.GetThumbnailImage(66, 99, null,
IntPtr.Zero); -- used to convert thumgnail images

MemoryStream imageStream = new MemoryStream();

//put the image into the memory stream


//make byte array the same size as the image
byte[] imageContent = new Byte[imageStream.Length];

/// rewind the memory stream
imageStream.Position = 0;

//// load the byte array with the image
imageStream.Read(imageContent, 0, (int)imageStream.Length);

//Set image type
Response.ContentType = "image/jpeg";

//Render the content



1 Answer Found

Didn't find what you were looking for? Find more on Thumb Nail Image Scenario Or get search suggestion and latest updates.