Photocopy is a WordPress plugin which automatically sends media uploads to Amazon S3 as they are being uploaded. It is useful for automating media backups and for off-loading data to free up space on your main server. When used as a media backup system, this plugin has an advantage in that it performs the backup process as the images are uploaded, so there is no risk that a backup hasn’t been run before you need to access it.
The plugin requires Curl. This is because the S3 class used within it requires Curl. This could be done via the WordPress http API, but I’d rather not mess with what appears to be a decent quality and perfectly functional off the shelf class.
Set the Amazon S3 access key, secret key and your chosen bucket name in your wp-config.php file (or anywhere which executes prior to ‘init’). You will need to obtain this information from Amazon directly.
define( 'AWS_ACCESS_KEY', 'JKEFSLDGNSJKGBSDGJ'); define( 'AWS_SECRET_KEY', 'LKafk+kalfskaKDSDGQWRLZVXMLKEOInsdgsd' ); define( 'AWS_BUCKET_NAME', 'ryans-personal-bucket' );
Now, when you upload an image via the WordPress media uploader, the files will be automatically backed up to Amazon S3 😀
Permanently moving uploads to S3
This plugin can also be useful for off-loading your uploads externally to free up disk space on your main site. An additional CDN plugin is required to make use of it in this fashion. I have previous run this type of setup on my own site, but stopped as I had trouble with setting the correct cache headers via Amazon S3. You would also need to find a way to force the admin panel to use the CDN URLs unless you want the image URLs to fail in the admin panel.