FIleImageProvider, save db size.

9 years ago
http://cid-3637afd2bcaa0a57.skydrive.live.com/self.aspx/Public/AWS.NopCommerce.FilePictureProvider.rar

Here is a project (.dll) that replaces the sql image provider with a file image provider. My clients db (Nop_Picture) was growing out of control.

It references v1.4, but there were no breaking changes in the 1.5 release so you can simply update references in the project to get it working.

In the web.config, there are some properties that you can set (nopdataproviders) that can help with the transition.

imageDirectory = where you want the images to be stored.
transferSqlPicturesFromConnectionStringName=the connection string where you want the images to be transfered from (or existing installations). Leave blank if you dont want to transfer anything.

Also you must also delete the foreign key restraints placed on Nop_Picture table. Open table in design view (sql management studio), click relationships. Either delete all the relationships there or set EnforceKeyRestraint (something like that) to false.


    <PictureProvider defaultProvider="FilePictureProvider">
      <providers>
        <add name="SQLPictureProvider" type="NopSolutions.NopCommerce.DataAccess.Media.SQLPictureProvider, Nop.DataAccess.SqlServer" connectionStringName="NopSqlConnection"/>
                <add name="FilePictureProvider" type="AWS.NopCommerce.FilePictureProvider.FilePictureProvider, AWS.NopCommerce.FilePictureProvider"
                     imageDirectory="~/images/images/"
                     transferSqlPicturesFromConnectionStringName="NopSqlConnection"/>
      </providers>
    </PictureProvider>

http://www.adeptwebstudios.com/
9 years ago
from v1.5 - you have option to choose save images in db or in filesystem - configurable in admin
-->configuration --> all settings          
Media.Images.StoreInDB    set to true or false