Giter Club home page Giter Club logo

amazons3cloudfront's Introduction

Amazon S3 CloudFront Module for ProcessWire 2.4+

This module/plugin provides a way to synchronize, serve and backup to Amazon S3/ CloudFront all the page files uploaded through the Admin of ProcessWire.

Requirements

  • ProcessWire 2.4;
  • Amazon AWS PHP SDK (included);
  • AWS account with S3 and CloudFront services enabled;
  • A S3 Bucket and a user with the proper privileges over it: "s3:PutObject", "s3:GetObject", "s3:DeleteObject" and "s3:PutObjectAcl";
  • A CloudFront distribution pointing to the S3 Bucket.

Installation

Put all the files inside /site/modules/AmazonS3Cloudfront/ and go to Admin>Modules>Check for New Modules and install.

You'll need to configure the module by entering your AWS Access and Secret keys and the name of the S3 Bucket you'll use to store the files. I've set up a video and a user policy document to help you out if you don't know how to do this.

How does it work

The module/plugin uploads the files to S3 immediately as you add them to the pages in the admin of ProcessWire. It mimics the PW asset structure inside the S3 Bucket you defined. (/S3BUCKET/PAGE_ID/files).

The deleted files on PW pages are also deleted immediately from S3 but you have the option to create a backup to another folder on S3 for backup purposes.

The Module supports the use of image thumbnails created by the Thumbnails module (FieldtypeCropImage) 1.0.3 by Antti Peisa (@apeisa) and uploads and modifies the thumbnails accordingly if this module is installed.

Note: The thumbnails natively created by the PW Admin (ex: filename_0x100.jpg) are served from the local assets folder and not uploaded to S3.

The module can automatically serve the content from Amazon CloudFront if a distribution is created for the S3 bucket used with this module. The files URL's are automatically replaced.

If you choose 'Set Expires Header' in the module configuration, all the files uploaded to S3 will have set the Expires tag that is a recommended performance improvement. See more information here.

Issues

This version of the module will only handle new files uploaded after the installation. If you already have files on your pages you'll definitely have errors.

If you use the native size() method of ProcessWire (ex: $image->size(232, 176))to create image thumbnails, they will not be uploaded to S3 automatically. This issue should be solved soon as the dev branch of PW already has this method hookable.

Notes

THIS PROCESSWIRE MODULE/ PLUGIN IS PROVIDED AS IS AND IT SHOULD ONLY BE USED FOR TEST PURPOSES. USE AT YOUR OWN RISK. THE AUTHOR IS NOT RESPONSIBLE FOR ANY DATA LOSSES OR COSTS ASSOCIATED WITH THE USE OF AMAZON AWS.

Copyright 2014 by Nelson Mendes E-mail

Built for ProcessWire

amazons3cloudfront's People

Watchers

 avatar

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.