Click here to Skip to main content
15,915,501 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: With out scroll tab need page...... Pin
enjoycrack18-Apr-07 7:17
enjoycrack18-Apr-07 7:17 
QuestionSERVER APPLICATION ERROR Pin
piya00718-Apr-07 0:16
piya00718-Apr-07 0:16 
AnswerRe: SERVER APPLICATION ERROR Pin
wEb GuRu...18-Apr-07 5:30
wEb GuRu...18-Apr-07 5:30 
QuestionAsp.net update panel [modified] Pin
koleraba17-Apr-07 23:49
koleraba17-Apr-07 23:49 
AnswerRe: Asp.net update panel Pin
enjoycrack18-Apr-07 7:18
enjoycrack18-Apr-07 7:18 
GeneralRe: Asp.net update panel Pin
koleraba19-Apr-07 1:23
koleraba19-Apr-07 1:23 
QuestionResizing images on upload Pin
AdamskiR17-Apr-07 23:40
AdamskiR17-Apr-07 23:40 
AnswerRe: Resizing images on upload Pin
Gavin Roberts18-Apr-07 0:42
Gavin Roberts18-Apr-07 0:42 
http://www.peterprovost.org/archive/2003/05/29/516.aspx[^]

I haven't played around with the Upload stuff yet so not sure whether you can access the uploaded file in memory and resize it before saving it.

If not, then you simply need to use something like

Boolean fileOK = false;<br />
            String path = Server.MapPath("~/uploadedconsultantimages/");<br />
            if (UploadImage.HasFile)<br />
            {<br />
                String fileExtension =<br />
                    System.IO.Path.GetExtension(UploadImage.FileName).ToLower();<br />
                String[] allowedExtensions = <br />
                { ".gif", ".png", ".jpeg", ".jpg" };<br />
                for (int i = 0; i < allowedExtensions.Length; i++)<br />
                {<br />
                    if (fileExtension == allowedExtensions[i])<br />
                    {<br />
                        fileOK = true;<br />
                    }<br />
                }<br />
            }<br />
<br />
            if (fileOK)<br />
            {<br />
                try<br />
                {<br />
                    UploadImage.PostedFile.SaveAs(path<br />
                        + UploadImage.FileName);<br />
<br />
					Bitmap source = Bitmap.FromFile(path + UploadImage.FileName);<br />
					Bitmap result = new Bitmap(250,250);<br />
					using(Graphics g = Graphics.FromImage((Image)result);<br />
					g.DrawImage(source, 0, 0, 250, 250);<br />
					result.Dispose();<br />
					source.Dispose();<br />
					result.Save(path + UploadImage.FileName);<br />
<br />
                    FileUploaded.Text = "File uploaded!";<br />
                }<br />
                catch (Exception ex)<br />
                {<br />
                    FileUploaded.Text = "File could not be uploaded.";<br />
                }<br />
            }<br />
            else<br />
            {<br />
                FileUploaded.Text = "Cannot accept files of this type.";<br />
            }


This is untested, but basically "should" resize the uploaded image to 250x250.
GeneralRe: Resizing images on upload Pin
AdamskiR18-Apr-07 0:55
AdamskiR18-Apr-07 0:55 
GeneralRe: Resizing images on upload Pin
Sandeep Akhare18-Apr-07 3:42
Sandeep Akhare18-Apr-07 3:42 
GeneralRe: Resizing images on upload Pin
AdamskiR18-Apr-07 4:11
AdamskiR18-Apr-07 4:11 
GeneralRe: Resizing images on upload Pin
Sandeep Akhare18-Apr-07 4:39
Sandeep Akhare18-Apr-07 4:39 
GeneralRe: Resizing images on upload Pin
AdamskiR18-Apr-07 4:51
AdamskiR18-Apr-07 4:51 
Questionpass argument to crystal report Pin
senthilmca17-Apr-07 23:12
senthilmca17-Apr-07 23:12 
AnswerRe: pass argument to crystal report Pin
Sylvester george17-Apr-07 23:16
Sylvester george17-Apr-07 23:16 
AnswerRe: pass argument to crystal report Pin
Member 387988118-Apr-07 0:32
Member 387988118-Apr-07 0:32 
QuestionFile Java Pin
kirthikirthi17-Apr-07 22:39
kirthikirthi17-Apr-07 22:39 
AnswerRe: J# Pin
Colin Angus Mackay17-Apr-07 23:50
Colin Angus Mackay17-Apr-07 23:50 
GeneralRe: J# Pin
kirthikirthi17-Apr-07 23:59
kirthikirthi17-Apr-07 23:59 
GeneralRe: J# Pin
Colin Angus Mackay18-Apr-07 6:25
Colin Angus Mackay18-Apr-07 6:25 
AnswerRe: J# Pin
J4amieC18-Apr-07 0:09
J4amieC18-Apr-07 0:09 
GeneralRe: J# Pin
kirthikirthi18-Apr-07 0:18
kirthikirthi18-Apr-07 0:18 
AnswerRe: J# Pin
Guffa18-Apr-07 0:17
Guffa18-Apr-07 0:17 
QuestionData Grid Delete using checkbox with customize delete button Pin
J Liang17-Apr-07 22:02
J Liang17-Apr-07 22:02 
AnswerRe: Data Grid Delete using checkbox with customize delete button Pin
piyush12317-Apr-07 22:40
piyush12317-Apr-07 22:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.