Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > FileUpload Control & Image Control

Reply
Thread Tools

FileUpload Control & Image Control

 
 
eamon
Guest
Posts: n/a
 
      08-04-2005
I would like to know if there is an eventhandler that i can use in order to
get an image in the image control from the file upload without having use a
button or is there a way i can get a thumbnail from the fileupload control?

Please help got a deadline and my boss is checking up on me frequently/
Thank You all

Eamon
 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      08-04-2005
You can resize the image using the GetThumbnailImage method.
Here's more info:
http://msdn.microsoft.com/library/de...ImageTopic.asp

Or maybe you'll find these custom functions I wrote to be useful:

public Image DisplaySize(Bitmap bmp)
{
Response.Write(bmp.Width.ToString());
Response.Write(bmp.Height.ToString());
}

//shrink the image proportionately so that neither height nor width is
//more than [NewSize] pixels

public System.Drawing.Image ShrinkImage(System.Drawing.Bitmap bmp, int
NewSize)

{

double NewWidth;

double NewHeight;

double ShrinkPercent;

System.Drawing.Image.GetThumbnailImageAbort myCallback =

new System.Drawing.Image.GetThumbnailImageAbort(Thumbn ailCallback);

if (bmp.Width>bmp.Height)

{

NewWidth=NewSize;

ShrinkPercent=(NewWidth/bmp.Width)*100;

NewHeight=(ShrinkPercent/100)*bmp.Height;

}

else

{

NewHeight=NewSize;

ShrinkPercent=(NewHeight/bmp.Height)*100;

NewWidth=(ShrinkPercent/100)*bmp.Width;

}

System.Drawing.Image myShrunkenImage =
bmp.GetThumbnailImage((int)NewWidth,(int)NewHeight ,myCallback,IntPtr.Zero);

return myShrunkenImage;

}

public bool ThumbnailCallback(){return false;}

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"eamon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I would like to know if there is an eventhandler that i can use in order to
> get an image in the image control from the file upload without having use
> a
> button or is there a way i can get a thumbnail from the fileupload
> control?
>
> Please help got a deadline and my boss is checking up on me frequently/
> Thank You all
>
> Eamon



 
Reply With Quote
 
 
 
 
eamon
Guest
Posts: n/a
 
      08-04-2005
Can anyone convert this code into VB for me please my project isn't compling
the one below because im using VB.

"Steve C. Orr [MVP, MCSD]" wrote:

> You can resize the image using the GetThumbnailImage method.
> Here's more info:
> http://msdn.microsoft.com/library/de...ImageTopic.asp
>
> Or maybe you'll find these custom functions I wrote to be useful:
>
> public Image DisplaySize(Bitmap bmp)
> {
> Response.Write(bmp.Width.ToString());
> Response.Write(bmp.Height.ToString());
> }
>
> //shrink the image proportionately so that neither height nor width is
> //more than [NewSize] pixels
>
> public System.Drawing.Image ShrinkImage(System.Drawing.Bitmap bmp, int
> NewSize)
>
> {
>
> double NewWidth;
>
> double NewHeight;
>
> double ShrinkPercent;
>
> System.Drawing.Image.GetThumbnailImageAbort myCallback =
>
> new System.Drawing.Image.GetThumbnailImageAbort(Thumbn ailCallback);
>
> if (bmp.Width>bmp.Height)
>
> {
>
> NewWidth=NewSize;
>
> ShrinkPercent=(NewWidth/bmp.Width)*100;
>
> NewHeight=(ShrinkPercent/100)*bmp.Height;
>
> }
>
> else
>
> {
>
> NewHeight=NewSize;
>
> ShrinkPercent=(NewHeight/bmp.Height)*100;
>
> NewWidth=(ShrinkPercent/100)*bmp.Width;
>
> }
>
> System.Drawing.Image myShrunkenImage =
> bmp.GetThumbnailImage((int)NewWidth,(int)NewHeight ,myCallback,IntPtr.Zero);
>
> return myShrunkenImage;
>
> }
>
> public bool ThumbnailCallback(){return false;}
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "eamon" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I would like to know if there is an eventhandler that i can use in order to
> > get an image in the image control from the file upload without having use
> > a
> > button or is there a way i can get a thumbnail from the fileupload
> > control?
> >
> > Please help got a deadline and my boss is checking up on me frequently/
> > Thank You all
> >
> > Eamon

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How check filesize using FileUpload control? VB Programmer ASP .Net 11 09-01-2012 09:05 AM
FileUpload control. Eric ASP .Net 4 11-03-2009 11:45 AM
Selecting a date with the Calendar control clears the FileUpload control Nathan Sokalski ASP .Net 1 01-11-2007 06:47 AM
Selecting a date with the Calendar control clears the FileUpload control Nathan Sokalski ASP .Net Web Controls 0 01-11-2007 05:13 AM
ASP.NET 2.0 FileUpload control Uncle Ben ASP .Net 5 03-23-2005 06:42 PM



Advertisments