
I have been using Amazon S3 to store the images on this blog for some time and these days I have decided to optimize the ones I have stored a little to save a few cents on transfers. Normally I optimize the images that I upload to the blog using ImageOptim, but the different thumbnails that Wordpress generates from the originals are not compressed and that is where space and transfer can be saved.
To carry out this task I had to fork gaganawhad’s Autosmush script to include compatibility with all Amazon S3 zones (America, Europe, Asia…) by adding a new parameter (r). This PHP script is run very simply by entering the following command from the terminal (I have tested it on Mac OS X).
php autosmush -r [region-name] -t some-s3-bucket-name/path/to/files
AWSAccessKeyId and AWSAccessSecret are required and are obtained from the credentials section of the AWS console.
You can download my version of Autosmush from my Github repository.