Our guide to midseason TV season & series premieres

Twitter Facebook

Adding CloudFront capability to WordPress Amazon S3 plugin

 

I’m going to start using Amazon S3′s CloudFront distribution service to better distribute and parralelize calls to images and such on my websites. However, since I use Joe Tan’s Amazon S3 for WordPress plugin, I couldn’t easily make use of CloudFront with WordPress uploads. So, as I usually do when I’m impatient, I altered the original code to not only allow for CloudFront, but if you supply multiple CNAMEs you assigned to your CloudFront distribution, it will randomize what hostname it returns when you add the image to your post!

Essentially I just added options for a CloudFront distribution hostname and then a spot for adding a CNAME (or multiple CNAMEs). When you upload your file, it should return a random CNAME for you, if any are entered.

Anyway, rather than paste all the diff code here, you can take a look at the diff file here. If you can’t figure it out, let me know and I’ll post the actual changed files. For me, it works as I’d hoped. Use at YOUR OWN RISK and, really, this is meant for people who are impatient like me and know at least how to code PHP a little. Hopefully Joe Tan will find this info useful and will update his plugin formally.

  • http://www.brentozar.com Brent Ozar

    Sweet! Unfortunately I’m no good with PHP, so I’ll hang tight til Joe can add it in or you post the full files, either way. Thanks man!

  • http://www.brentozar.com Brent Ozar

    Sweet! Unfortunately I’m no good with PHP, so I’ll hang tight til Joe can add it in or you post the full files, either way. Thanks man!

  • http://www.kensavage.com Ken Savage

    Ditto to what Brent said.

  • http://www.kensavage.com Ken Savage

    Ditto to what Brent said.

  • Keith McDuffee

    If you want the files, I put them up *temorarily* at http://www.cliqueclack.com/other/tantan-s3a.tar.gz

  • Keith McDuffee

    If you want the files, I put them up *temorarily* at http://www.cliqueclack.com/other/tantan-s3a.tar.gz

  • http://www.ad60.com/ Jason Reposa

    I just ran the patch and it failed. I’m assuming this is because the tantan-s3 plugin has been updated since you’ve posted your patch.

    Are you still using this plugin? If so, do you have an up to date patch?

    Thanks!