Hallo Liste,

�ber ein Webinterface stelle ich die M�glichkeit bereit, Bilder
upzuloaden. Den Bildnamen erg�nze ich durch einen GUID und speichere das
Bild in zwei verschiedenen Gr��en. Das funktioniert soweit wunderbar.
Allerdings ergibt sich ein Problem. 

Die eine Bildgr��e die ich erstelle (50px * x) hat immer eine Dateigr��e
um die 1-3KB. Die zweite Bildgr��e (300px * x) hat immer die
Originaldateigr��e des hochgeladenen Bildes. Ich will hier aber eine
Kompression erzielen.
Hat einer einen Tipp, woran es liegt.

<-------snip---------->
string[] tmp = this.TextBoxFile.PostedFile.FileName.Split(new
Char[]{'\\'},                   20);
string File = System.Guid.NewGuid().ToString() + "_" +
tmp[tmp.Length-1];
File = File.Split(new Char[]{'.'},10)[0] + ".png";

System.Drawing.Image.GetThumbnailImageAbort myCallback = new
System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);

Bitmap bmp1 = new Bitmap(this.TextBoxFile.PostedFile.InputStream);
                                this.TextBoxFile = null;

int heightsmall = (int)(((float)bmp1.Height) / 100 * (100 /
((float)bmp1.Width) * 60));

int heightlarge = (int)(((float)bmp1.Height) / 100 * (100 /
((float)bmp1.Width) * 300));

System.Drawing.Image Thumbnail1 = bmp1.GetThumbnailImage(60,
heightsmall,                    myCallback, IntPtr.Zero);

Thumbnail1.Save(ImagePath + "small_" + File,
System.Drawing.Imaging.ImageFormat.Png);

Thumbnail1 = null;

System.Drawing.Image Thumbnail2 = bmp1.GetThumbnailImage(300,
heightlarge,                                            myCallback,
IntPtr.Zero);

Thumbnail2.Save(ImagePath + "large_" + File,
System.Drawing.Imaging.ImageFormat.Png);

Thumbnail2 = null;
bmp1 = null;
<-------snip---------->


Gru�

Ren�


| [aspdedotnet] als [email protected] subscribed
| http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.dotnetgerman.com/listen/aspDEdotnet.asp

Antwort per Email an