Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ImageEditor > "A generic error occurred in GDI+"

Not answered "A generic error occurred in GDI+"

Feed from this thread
  • Shreya avatar

    Posted on May 22, 2012 (permalink)

    Hello Team,

    I am using Telerik Image Editor. I want to save and overwrite file on custom path using RadImageEditor_ImageSaving Server side event.

     when I modify image and try to save it on same path, I am getting error "A generic error occurred in GDI+"

     Please Note: I want to maintain only two versions of file 1) Original file 2) Updated file

      protected void RadImageEditor1_ImageSaving(object sender, ImageEditorSavingEventArgs args)
            {


               
                var context = new EBABBLEEntities();


                Account Lo_Account = (from acc in context.Accounts where acc.Id == cls_Session.User.Id select acc).FirstOrDefault();
                System.Drawing.Image newImage = args.Image.Image;


                string filename = Path.GetFileNameWithoutExtension(ImageURL);
                int indexer = filename.IndexOf("_Edited");


                if (indexer != -1)
                {
                    newImage.Save(Server.MapPath("~" + Lo_Account.files_path + "/My_DigiGLUS/") + filename.Substring(0, (filename.Length) - 7) + "_Edited" + Path.GetExtension(ImageURL));


                }
                else
                {
                    newImage.Save(Server.MapPath("~" + Lo_Account.files_path + "/My_DigiGLUS/") + Path.GetFileNameWithoutExtension(ImageURL) + "_Edited" + Path.GetExtension(ImageURL));
                }


              
                args.Cancel = true;
                DigiId = Convert.ToInt32(Request.QueryString["digigluId"].ToString());
                DigiGLUs Editdigiglu = (from digi in context.DigiGLUs where digi.Id == DigiId select digi).FirstOrDefault();


                if (indexer != -1)
                {
                    Editdigiglu.NewImageName = filename.Substring(0, (filename.Length) -7) + "_Edited" + Path.GetExtension(ImageURL);




                }
                else
                {
                    Editdigiglu.NewImageName = Path.GetFileNameWithoutExtension(ImageURL) + "_Edited" + Path.GetExtension(ImageURL);
                }




                context.SaveChanges();
    }
    Please review the code, help me to find where I am doing wrong. I really appreciate your help to solve this issue....

    Reply

  • Rumen Rumen admin's avatar

    Posted on May 24, 2012 (permalink)

    Hello,

    I believe that the following forum thread could be helpful for your to resolve this generic ASP.NET error:

    http://stackoverflow.com/questions/1044085/a-generic-error-occurred-in-gdi.

    Kind regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ImageEditor > "A generic error occurred in GDI+"
Related resources for ""A generic error occurred in GDI+""

ASP.NET Image Editor Features  |  Documentation  |  Demos  |  Step-by-step Tutorial  ]