Giter Club home page Giter Club logo

magento-mediastoragesync's Introduction

Phoenix Media Storage Sync

The module retrieves files in /media from an origin server.

What it does

Imagine you have a fresh local development environment with the Magento code checked out. You retrieved the database but you don't have any of the media assets and your store frontend just looks incomplete. You could grab a huge archive of the media folder from the production environment but no one really wants to download tens of gigabytes just to work on a few catalog pages.

This modules implements some plugins and observers that downloads images of categories, products and CMS blocks/pages from a configurable origin server similar to a CDN the first time you load an entity from the database. This means you can forget about the media folder and just browse the frontend as images are downloaded and saved transparently.

How it works

In the module's configuration you can configure a base URL, the domain where your production/staging Magento instance is located from which to picked the database. In the database the relative paths of categories and product images are stored. Once those entities are loaded the module simply checks if their images are already in media/catalog. If not it uses the base URL, appends the relative image path from the database and downloads the files from origin server. This slows down page generation the first time you access a page but improves pretty quickly.

For other assets in the media folder we make use of another mechanism: Maybe you recognized Magento is shipped with a get.php file in the Magento root. It was intended to retrieve image data from a database, save it on the host's filesystem and then deliver it. Well, our assets are located at a different web server but beside the retrieval of the asset data the rest is pretty similar. The get.php is called via a mod_rewrite rule in the media/.htaccess or equivalent rules in your nginx configuration. The process is triggered every time a file in /media is not found so it is only triggered the first time. The MediaStorageSync module downloads the file, saves it and the get.php delivers the file. On the second load the web service can directly deliver the static asset.

How to use

Manually copy the files in the app folder to your Magento app folder and clear the cache.

How to configure

Find the modules configuration in the PHOENIX MEDIA section of your Magento configuration.

Enable: Enable or disable the functionality

URL: Configure the source URL where to retrieve the images (e.g. "https://magento.com/")

optionally configure credentials for BasicAuth.

magento-mediastoragesync's People

Contributors

phoenix-bjoern avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

luisgcastillos

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.