Past couple of days I have been focusing hard to optimize my blog. Related to this I have been working on the next version of s3 plugin.
This version supports the following
- Uploads any media file in the blog to a CDN
- Support for cloudfront
- Expire headers
- Support for CSS and JS compression
- Dynamic Cache prefix
Other developers can use this plugin to upload the files to s3 for example
1. This will scan the given content for images belonging to same domain. And will schedule the images for s3 upload. If the upload is done it will replace them in the text.
<?php if(class_exists('S3Plugin')){ $output = S3Plugin::scanForImages($output); }
2. Advanced if you are control freak like me you would like to get more options.
<?php if(is_singular()){ $attachmentDetails = &get_children( "numberposts=1&post_type=attachment&post_mime_type=image&post_parent=" . get_the_ID() ); if(!empty ($attachmentDetails)){ $attachmentDetails = array_shift($attachmentDetails); $postImage = array_shift(wp_get_attachment_image_src($attachmentDetails->ID,'thumbnail')); if(class_exists('S3Plugin')){ $cdnImageURL = S3Plugin::getCDNURL($postImage); if($cdnImageURL!==FALSE){ $postImage = $cdnImageURL; } } } }
If you are interested in testing please download the wp-s3 1.1 Alpha or checkout from wp-s3 plugin repository trunk.
And another happy new is my blog got a descent page speed score with this plugin update 😉
Note: Please not this plugin is in alpha stages. Please test this on local test environment before testing it on production sites.