If pictures are stored in database, any attempt to display Picture will cause all PictureBinary to loads.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hi,

I have put my database on separate server and run nopCommerce from web server. I have noticed that there are a lot more traffic going on between 2 servers.

I have tried to track down the problem and found that within PictureService.cs there a a line that does this:

public string GetPictureUrl(Picture picture, int targetSize,
            bool showDefaultPicture)
        {
            string url = string.Empty;
            if (picture == null || picture.LoadPictureBinary().Length == 0)
            {
                if(showDefaultPicture)
                {
                    url = GetDefaultPictureUrl(targetSize);
                }
                return url;
            }

which means, the front end server will pull the entire picture form database (on another server) into memory, in thise case - caching that GetPictureUrl trying to do have no effect to improve performance or database usage.

So I have created my own version (I also require custom resizing) which does not attempt to use picture.LoadPictureBinary() but when i use the picture object - the entire picture inside PictureBinary still loads.

I would suggest that the entity mapping has to be remapped to not pre-load the PictureBinary field.
12 years ago
Code?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.