1.9 -> 2.0 Upgrade - 500 error-Store Images to file

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
I upgraded my store to 2.0 from 1.9, everything went smoothly, following the instructions. I store my images locally to file. Once the upgrade was finished and I copied/unzipped my backed up images to the Content/Images directory. When I click "Change" on the "Pictures are stored into...:" In order to change to storing files to the filesystem. I get a 500 error (exception). I will debug this later. But throwing it out there for input/resolution.
12 years ago
Hard to imagine that no one else had this problem. The code is throwing the exeception at

       public byte[] ValidatePicture(byte[] pictureBinary, string mimeType)
        {
            using (var stream = new MemoryStream(pictureBinary))
            {
                var b = new Bitmap(stream);  <--Parameter is not valid
12 years ago
Currently getting this error too.  Picture service location is on my desktop, not sure how to fix this however.

[ArgumentException: Parameter is not valid.]
   System.Drawing.Bitmap..ctor(Stream stream) +457609
   Nop.Services.Media.PictureService.ValidatePicture(Byte[] pictureBinary, String mimeType) in C:\Users\Basil\Desktop\thrifty\Libraries\Nop.Services\Media\PictureService.cs:488
   Nop.Services.Media.PictureService.UpdatePicture(Int32 pictureId, Byte[] pictureBinary, String mimeType, Boolean isNew) in C:\Users\Basil\Desktop\thrifty\Libraries\Nop.Services\Media\PictureService.cs:612
   Nop.Services.Media.PictureService.set_StoreInDb(Boolean value) in C:\Users\Basil\Desktop\thrifty\Libraries\Nop.Services\Media\PictureService.cs:697
   Nop.Admin.Controllers.SettingController.ChangePictureStorage() +136
   lambda_method(Closure , ControllerBase , Object[] ) +62
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
   System.Web.Mvc.Controller.ExecuteCore() +116
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
12 years ago
Similar situation.  Trying to change back to file system picture storage after upgrading and get the following:

We're sorry, an internal error occurred that prevents the request to complete.

Our supporting staff has been notified with this error and will address this issue shortly. We profusely apologize for the inconvenience and for any damage this may cause. You might want to try the same action at later time.


UPDATE:

In the Settings table, I just manually edited the value for "media.images.storeindb" and changed it from False to True.

After the change, the pictures appeared when the product pages were refreshed in the browser.  

Two questions:
1. Is there something wrong with the code logic here for this error to trigger?
2. Is the logic reversed?  Seems like the true/false conditions are backwards.

Note before manually editing (media.images.storeindb=False), the configuration screen said:

Pictures are stored into...:   database  Change NOTE: Do not forget to backup your database before changing this option.

After manually editing (media.images.storeindb=True), it said:

Pictures are stored into...:   file system  Change NOTE: Do not forget to backup your database before changing this option.

Also, the error I posted above still appears after manually changing the record, if you click on the Change button.

Note that this manual edit was not made via the nopCommerce Admin panel (due to error), but via a SQL connection to the table.

This was all done after step 6 of the upgrade instructions: "6. If your pictures were stored on the file system, then manually copy them into \Content\Images (previously they were stored into \images directory)"
12 years ago
Clicking the "Change" button does set the media.images.storeindb to True or False in the db. The error is occuring after that is set. False = Filesystem. SWW, I suspect you just manually changed it back to the db, by setting it to True. In stepping through the code, it seems to only throw the exception when trying to process a picture with a PictureBinary of 0x in the db which is creating an invalid stream (Parameter is not valid), which all images are 0x when the 1.9 db was set to store in filesystem. So, from what I see, we are able to change to the filesystem storage, and just (for now) deal with the exception thrown, as long as we already have our existing images in the Content\Images directory. BUT, I have not tried to add new images since upgrading either, I'll try that later and see....
12 years ago
angiengreg wrote:
Clicking the "Change" button does set the media.images.storeindb to True or False in the db. The error is occuring after that is set. False = Filesystem. SWW, I suspect you just manually changed it back to the db, by setting it to True.


Except that the 1.9 setup that I was upgrading from used the file system, not the database.  So setting it to true in 2.0 (after upgrading) caused the pictures (in the file system, not the db) to start appearing in the cart.  Hence, my comment that the logic seems backwards according to the behavior I am seeing..
12 years ago
Update:  I just tracked down another error when adding items to cart or wish list. It was resolved by granting file permissions on the Images folder for the web site userid.  On Arvixe, the user name is the website domain name.  At any rate, that also cleared the error I was getting when switching to/from database v.s. file system image storage.
12 years ago
I'm receiving the same error while changing to store in db to filesystem. does it convert binary data on this to store them in filesystem and remove image binary data from db?
11 years ago
Does anybody have any solution to this? I'm getting the same error on a new 2.50 installation, which has always been set to store images on the file system.  It seems to occur on products which only have our 'default' image.
11 years ago
"Hard to imagine that no one else had this problem. The code is throwing the exeception at

       public byte[] ValidatePicture(byte[] pictureBinary, string mimeType)
        {
            using (var stream = new MemoryStream(pictureBinary))
            {
                var b = new Bitmap(stream);  <--Parameter is not valid"



I am also having this problem. After upgrading from 2.4 to 2.6. NONE of my images are displaying in the store. Tried resetting the store. Nothing. Images were always stored in the DB from version 1.9. Had no problems going to 1.9 to 2.4. Tried to move the images onto the file system from the DB and I get the above exception. How do I get my images to dispay? I have verified that the images are in the DB using MS SQL Manager.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.