Shero Support

How can we help?

Follow

Alternate Media Storage

Using a Database as Alternate Media Storage

Magento Enterprise Edition allows you to store media files in a database on a database server or in a Content Delivery Network (CDN), as opposed to storing them on the file system of the web server. By default, all images, CSS files and JavaScript files are stored on the web server. Storing media files on a database allows for automatic synchronization and reverse synchronization between the web server file system and the database. 

You can use the default database to store media or create a new one. To be able to use a newly created database as media storage, you must add information about it and its access credentials to the local.xml file. To switch to using a database as media storage or change to another database, do the following.

This configuration is done at the global level.
1. Navigate to System > Configuration > ADVANCED > Advanced > System > Storage Configuration for Media.
2. In the Media Storage drop-down menu, select Database. The Select Media Database drop-down menu and the Synchronize button appear. In the drop-down menu, all the databases that are specified in the local.xml file are listed.
3. In the Select Media Database drop-down menu, select the database you want to use.
4. Click the Synchronize button to transfer the existing media to the newly selected database.
Accessing Media from a Database
To get the files from the database to the file system on the web server a PHP script is used. When the browser requests media from the web server, there are two alternatives of when a PHP script is run:
1. If web server rewrites are enabled in the Magento system and supported by the server, the PHP script is run only when the requested media is not found in the web server file system.
2. If web server rewrites are disabled in the Magento system or not supported by the server, the PHP script is run in any case, even when the required media exists in the file system of the web server.
Note: You can configure web server rewrites in System > GENERAL > Web > Search
Engine Optimization > Use Web Server Rewrites.
CDN as Alternate Media Storage
Storing media files in a CDN is another alternative supported in Magento. There is no full integration with a specific CDN, and you are responsible for choosing and configuring a CDN on your own.
After configuring the CDN, you must perform the following changes in the Admin Panel; these changes can be made at either the global or website level:
1. Navigate to System > Configuration > GENERAL > Web.
2. Change the value of the Base Media URL and Base JavaScript URL fields in the Unsecure and
Secure field groups. Change the value of the Base Skin URL field if you want skins to be stored on the CDN as well.

Comments