Hejsa driis
jeg har brugt følgende kode:
http://www.csharp-station.com/Articles/Thumbnails.aspxog skrevet lidt af det om til dette:
// create an image object, using the filename we just retrieved
System.Drawing.Image image = System.Drawing.Image.FromFile(file);
// create the actual thumbnail image
System.Drawing.Image thumbnailImage = image.GetThumbnailImage(Convert.ToInt16(imgWidth), Convert.ToInt16(imgHeight), new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);
// make a memory stream to work with the image bytes
MemoryStream imageStream = new MemoryStream();
System.Drawing.Imaging.ImageFormat format = image.RawFormat;
// put the image into the memory stream
thumbnailImage.Save(imageStream, format);
// 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);
string contentType = "";
switch (format.Guid.ToString()) {
case "b96b3cb0-0728-11d3-9d7b-0000f81ef32e":
contentType = "image/gif";
break;
case "b96b3cae-0728-11d3-9d7b-0000f81ef32e":
contentType = "image/jpeg";
break;
case "b96b3caf-0728-11d3-9d7b-0000f81ef32e":
contentType = "image/png";
break;
case "b96b3cab-0728-11d3-9d7b-0000f81ef32e":
contentType = "image/bmp";
break;
default:
contentType = "image/jpeg";
break;
}
// return byte array to caller with image type
Response.ContentType = contentType;
Response.BinaryWrite(imageContent);
Kan du lede mig i retning af hvad det er jeg kan gøre ?