A generic error occurred in GDI+

12 年 前

We've decided to try out nopCommerce for our brand new web store, it looks great so far, good work guys!

We haven't added any products to our catalogue yet, but still have the default (bundled) products.
When we try to view any products on the website we get the following error:

[quote]A generic error occurred in GDI+. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.

Source Error:

Line 62:                     ProductPictureCollection productPictures = product.ProductPictures;
Line 63:                     if (productPictures.Count > 0)
Line 64:                         hlImageLink.ImageUrl = PictureManager.GetPictureUrl(productPictures[0].Picture, 125, 125, true);
Line 65:                     else
Line 66:                         hlImageLink.ImageUrl = PictureManager.NoImageURL;

Source File: c:\Inetpub\wwwroot\Modules\Products\ProductBox.ascx.cs    Line: 64

[ExternalException (0x80004005): A generic error occurred in GDI+.]
   System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) +377518
   System.Drawing.Image.Save(String filename, ImageFormat format) +69
   NopSolutions.NopCommerce.Common.BLL.Managers.PictureManager.GetPictureUrl(Picture picture, Int32 Width, Int32 Height, Boolean showDefaultPicture) in D:\Work\Own\NopCommerce\Solution\NopCommerce\Nop.Common\BLL\Managers\PictureManager.cs:168
   NopSolutions.NopCommerce.Web.Modules.Products.ProductBoxControl.BindData() in c:\Inetpub\wwwroot\Modules\Products\ProductBox.ascx.cs:64
   NopSolutions.NopCommerce.Web.Modules.Products.ProductBoxControl.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\Modules\Products\ProductBox.ascx.cs:44[/quote]

Any suggestions as to what this could be?
It looks like it is trying to reference a module and is looking in D:\Work\Own\NopCommerce\Solution\NopCommerce\Nop.Common\BLL\Managers\PictureManager.cs for it, which it isn't going to find.
12 年 前

Solved this one pretty quickly by reading the stack trace, which I probably should have done before.

Turns out that the IIS user account did not have write/amend access to the required folder (/images). With this on all is now working fine.


12 年 前
Hi There,

I have the same GDI problem on godaddy. What user should have access to the Images/thumbs folder? Please let me know. Any help is much appreciated.


12 年 前
images are cached to disk using Bitmap.Save

You need to make sure that the ASPNET user has write access to the /images/thumbs directory
12 年 前
That did it. Thank you so much. nopCommerce ROCKS !!!!!!!!!!!