By default, nopCommerce stores all of the images in the database, making for simple access. However, with a lot of images, this puts a lot of load on the database, alongside making for a larger database to maintain.
Storing in Database
- Allows for easier backups & environment clones (only need to clone codebase and DB)
- Single place for image storage (useful with multiple systems)
Storing on Fileserver
- Separates large portion of data from DB (allows for smaller DB)
- Lowers load on DB server.
First, back up your database – since this is a process that can cause major issues if something were to go wrong (or if you decide to revert back to storing images in the database).
To convert from storing images in the database to the file server, go to Admin -> Settings -> Media Settings. Click on ‘Change’:
After the conversion completes, nopCommerce will automatically convert all images into the /Content/Images folder. You’ll also notice the binaries no longer being stored in the
Once this is done, you have the potential to open a good amount of space on the database, since the binaries of the images are now stored on the fileserver themselves.
To reclaim this space, you’ll need to shrink the database. Run the following command in SQL:
DBCC SHRINKDATABASE (YOUR_DB, 10); GO