Click here to Skip to main content
16,020,811 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: change forecolor of a label in gridview Pin
laziale16-Mar-10 3:17
laziale16-Mar-10 3:17 
QuestionBulletedList control Pin
hotthoughtguy15-Mar-10 8:03
hotthoughtguy15-Mar-10 8:03 
AnswerRe: BulletedList control Pin
Sandeep Mewara15-Mar-10 9:23
mveSandeep Mewara15-Mar-10 9:23 
AnswerRe: BulletedList control Pin
Brij15-Mar-10 9:31
mentorBrij15-Mar-10 9:31 
GeneralRe: BulletedList control Pin
Abhijit Jana15-Mar-10 9:53
professionalAbhijit Jana15-Mar-10 9:53 
GeneralRe: BulletedList control Pin
Brij15-Mar-10 18:18
mentorBrij15-Mar-10 18:18 
GeneralRe: BulletedList control Pin
Abhijit Jana15-Mar-10 19:51
professionalAbhijit Jana15-Mar-10 19:51 
QuestionA generic error occurred in GDI+ on bitmap.save Pin
VinothRao15-Mar-10 4:49
VinothRao15-Mar-10 4:49 
Hi,

I'm trying to solve this issue for 1 week, and i can't seems to solve it.

I search through net, they say its most probably because of permission access.
I have given full rights for all the users, including "Everybody", but error still remains.

This error only will occurs after upload twice, or 3 times, or on the 5th file of uploading. Its random. So i suspect its not the permission access problem.

Below is summary of my codes.

System.Drawing.Image image = ResizeImageImg(fp.PostedFile.InputStream, ImageWidth, ImageHeight);<br />
image.Save(savepath, ImageFormat.Jpeg); // ERROR RAISE HERE<br />
<br />
image.Dispose();



private System.Drawing.Image ResizeImageImg(Stream streamImage, int maxWidth, int maxHeight)<br />
{<br />
    Bitmap originalImage = new Bitmap(streamImage);<br />
    int newWidth = originalImage.Width; // 148px<br />
    int newHeight = originalImage.Height; // 170px<br />
    double aspectRatio = (double)originalImage.Width / (double)originalImage.Height;<br />
<br />
    if (aspectRatio <= 1 && originalImage.Width > maxWidth)<br />
    {<br />
        newWidth = maxWidth;<br />
        newHeight = (int)Math.Round(newWidth / aspectRatio);<br />
    }<br />
    else if (aspectRatio > 1 && originalImage.Height > maxHeight)<br />
    {<br />
        newHeight = maxHeight;<br />
        newWidth = (int)Math.Round(newHeight * aspectRatio);<br />
    }<br />
<br />
    System.Drawing.Image CropedImage = new Bitmap(newWidth, newHeight);<br />
    using (Graphics grp = Graphics.FromImage(CropedImage))<br />
    {<br />
        grp.SmoothingMode = SmoothingMode.HighQuality;<br />
        grp.InterpolationMode = InterpolationMode.HighQualityBicubic;<br />
        grp.PixelOffsetMode = PixelOffsetMode.HighQuality;<br />
        grp.DrawImage(originalImage, 0, 0, newWidth, newHeight);<br />
<br />
        grp.Dispose();<br />
        originalImage.Dispose();<br />
    }<br />
<br />
    return CropedImage;<br />
}


Please help guys. If you do have any simple working codes, please share.

Thx.
AnswerRe: A generic error occurred in GDI+ on bitmap.save Pin
JHizzle15-Mar-10 5:27
JHizzle15-Mar-10 5:27 
GeneralRe: A generic error occurred in GDI+ on bitmap.save Pin
VinothRao15-Mar-10 14:33
VinothRao15-Mar-10 14:33 
QuestionMultiple Email ids Validating Pin
MallikarjunaGupta15-Mar-10 3:50
MallikarjunaGupta15-Mar-10 3:50 
AnswerRe: Multiple Email ids Validating Pin
David Mujica15-Mar-10 4:28
David Mujica15-Mar-10 4:28 
AnswerRe: Multiple Email ids Validating Pin
JHizzle15-Mar-10 4:37
JHizzle15-Mar-10 4:37 
AnswerRe: Multiple Email ids Validating Pin
Sandeep Mewara15-Mar-10 9:17
mveSandeep Mewara15-Mar-10 9:17 
QuestionTemplateField gridview Pin
mahmoudinirat15-Mar-10 2:57
mahmoudinirat15-Mar-10 2:57 
AnswerRe: TemplateField gridview Pin
Abhijit Jana15-Mar-10 3:42
professionalAbhijit Jana15-Mar-10 3:42 
AnswerRe: TemplateField gridview Pin
Sandeep Mewara15-Mar-10 9:12
mveSandeep Mewara15-Mar-10 9:12 
GeneralRe: TemplateField gridview Pin
Abhijit Jana15-Mar-10 9:55
professionalAbhijit Jana15-Mar-10 9:55 
GeneralRe: TemplateField gridview Pin
Sandeep Mewara15-Mar-10 10:14
mveSandeep Mewara15-Mar-10 10:14 
GeneralRe: TemplateField gridview Pin
Abhijit Jana15-Mar-10 10:18
professionalAbhijit Jana15-Mar-10 10:18 
GeneralRe: TemplateField gridview Pin
Sandeep Mewara15-Mar-10 20:30
mveSandeep Mewara15-Mar-10 20:30 
GeneralRe: TemplateField gridview Pin
Abhijit Jana15-Mar-10 20:54
professionalAbhijit Jana15-Mar-10 20:54 
Questionhow to run bat file from server on client machine [modified] Pin
Gaurav Dudeja India14-Mar-10 22:55
Gaurav Dudeja India14-Mar-10 22:55 
AnswerRe: how to run bat file from server on client machine Pin
JHizzle14-Mar-10 23:25
JHizzle14-Mar-10 23:25 
GeneralRe: how to run bat file from server on client machine Pin
Gaurav Dudeja India14-Mar-10 23:28
Gaurav Dudeja India14-Mar-10 23:28 

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.