CDN Tools

Due to time constraints, CDN Tools is not currently being maintained. If you’re interested in taking over, let me know!

CDN Tools is a WordPress plugin designed to help you drastically speed up your blog’s load time by loading content onto a distribution network (CDN).  You can use a commercial CDN or just load some of your larger JS libraries for free from Google’s servers!  At this time Rackspace Cloud Files is the only supported service, but Amazon S3 will be added soon.

View a screencast of how to set up your WordPress blog with CDN Tools!

Features

  • One click load all attachments and JS to a CDN
  • Transparently sideload new content (including images resized by WP!)
  • Automatically rewrite URLs on your blog to point at the CDN-loaded content.
  • Easy deactivation if you decide to stop using it. No messy fixes to get back to a pristine WP install. Just remove the plugin and everything will work fine!

CDN Tools is still early in its life so please do not hesitate to contact me with bugs or feature suggestions. At the moment there are a few major features I’m planning to add:

  • i18n support (this will require translators)
  • Error handling! (Some exceptions are not caught at this time)
  • More CDNs (eventually, this is low priority until the core is stable)

Requirements

CDN Tools requires PHP5 (with the cURL extension installed) and WP 2.9 or newer. It may work on older versions of WP, but I haven’t tested it. It emphatically will not work on PHP < 5.0.

Download

You can download CDN Tools through the wordpress.org plugin repository homepage.

Version History

v1.0 – 6/29/2010
- WP 3.0 compatibility
- Changed method of storing info about sideloaded files to be far more robust.
- Use directory structure on Cloud Files (uses just one container now)
- Now CDNifies post thumbnails as well (WP 2.9+ feature)
- Fix for blogs using SSL
- Caches credentials for more rapid initial loads/multiple media attach uploads.
- You can now define constants in wp-config for plugin configuration. This allows to configure settings that will be active on all end-user sites without allowing them to see/edit the config. If you define constants the CDN Tools admin page will not register a configuration page.

v0.99 – 12/31/2009
- Log retention support (in advanced options)
- Servicenet flag (in advanced options)
- Both these features were added courtesy of John Dickinson

v0.98 – 12/13/2009
- WordPress 2.9 support. CDN Tools can now handle the image edit system introduced in WP 2.9.
- Better error handling for a few scenarios.
- As of this release WP 2.7 is no longer supported. It might work, but future releases will almost certainly break it.

v0.97 – 12/9/2009
- Initial sideload AJAX used an absolute path with the siteurl. This should have been a relative path or the adminurl to accommodate situations were FORCE_SSL_ADMIN is defined. Thanks to John for identifying the bug.

v0.96 – 12/4/2009
- Upgraded and (temporarily) forked CloudFiles API to fix bugs related to safe_mode and content type detection. This means you shouldn’t see badcontenttype exceptions or “stuck at 0%” errors any more!
- Improved error reporting for AJAX uploads (including timeout errors, which are now set at 90 seconds)
- Removed loading.gif in favor of WP native spinner

v0.95 – 10/25/2009
- Upgraded to CF API 1.5.1. For users within the Rackspace network who have $_ENV['RACKSPACE_SERVICENET'] defined, CDN Tools will now use the servicenet instead of the public network. This should speed sideloading of large files as well as not consuming your bandwidth.

v0.94 – 10/19/2009
- Upgraded to CF API 1.4. This should resolve some cURL issues users have experienced and removes the dependence on a png hack for RHEL4 users.
- Fixed major issue with Google AJAX CDN. Previously users were unable to switch between visual and HTML mode on the edit post page.

v0.93 – 10/8/2009
-A partial fix for issues with customers who have full file paths stored in their postmeta table. This is not a complete fix, but should help some (most?) users.
-Other small bug fixes.

v0.92 – 10/5/2009
-Major upgrade to support WP 2.8. If you are a previous user of CDN Tools you MUST unload files and then load them again. Please let me know if you have issues because several major changes were made.

v0.81 – 5/17/2009
-Major upgrade to the initial load for attachments. Now done via AJAX with percentage progress.
-Additional exception handling (this is still incomplete)
-Upgrade to CF API 1.3.0.
-Wordpress MU compatible (credit John Keyes)

v0.72 – 2/25/2009
-First public release, no changes from previous.

v0.72 – 2/22/2009
-Small bugfixes
-WP Super Cache compatibility.

v0.71 – 2/22/2009
-Workaround for a MIME/PHP bug on RHEL4.

v0.7 – 2/17/2009
-Nearing completion of initial feature set.
-UI rework (again)

v0.6 – 2/15/2009
-Huge improvements on all fronts

v0.4 – 2/8/2009
-Initial sideload support.

v0.2 – 2/7/2009
-First release outside of my own work (seeded to Major Hayden).
-GoogleAJAX for Prototype, jQuery, Dojo, and mootools (free for anyone to use)
-Uploading JS to CloudFiles (only supported CDN presently)
-Supports opting out of CDN’ing wp-admin scripts.

Leave a comment ?

181 Comments.

  1. Paul, getting the following error. The path being referenced is for the old host we used – I moved to Amazon EC2 last year and cannot find where it is referenced. Look forward to trying this (and Rackspace) out.

    Thanks in advance, Jay

    A file failed to upload. CDN Tools will behave inconsistently if all files do not upload successfully! You should contact the developer with this info:
    Invalid response (202): Unexpected HTTP return code: 202failed create_paths /users/home/jaybna/domains/styleblueprint.com/web/public/wp-content/uploads/2008/12/paperdoll-300×181.jpg

    Click Okay to continue uploading, or cancel to abort.

  2. I need help with setting up CDN Tools. I don’t have a CDN but would like to use it. All I can do is put ‘true’ for “Use Google AJAX CDN” and then choose ‘none’ for “Primary CDN.” Even when I sign up for an AJAX Search API Key and put it in there, it doesn’t help. What am I doing wrong? What am I not understanding?

  3. Nima,
    When using Google AJAX CDN you don’t need to put in any API key at all. You just set it to Google AJAX + None and you’re done. JS libs will be loaded from google’s CDN with that setting.

  4. Hi Paul,

    Getting tons of errors on uploading files from Cloud Sites to Cloud Files – too may to post here. Most files go but eventually the upload completely hangs. Can I email errors to you?

    Thanks

  5. I’m having problems with this plugin too. My upload gets to 97% and stops. I’ve tried several times but it never completes.

    Also, I’ve noticed that the theme files aren’t tranferred to the cloud.

    Finally, when I look at my website using Chrome’s inspect element feature and look at the resources my website is loading images from the cloud and those SAME images from my wordpress installation. How do I fix this?

  6. Hi Paul, i get the same error:
    A file failed to upload. CDN Tools will behave inconsistently if all files do not upload successfully! You should contact the developer with this info:

    Fatal error: Uncaught exception ‘InvalidResponseException’ with message ‘Unexpected response (): ‘ in /xxxxxxxx/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/cloudfiles.php:203
    Stack trace:…..

  7. i am getting an error when i try to activate the plugin

    Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit in safe mode

  8. HI, I run a handful of sites and installed this on one of them no problems at all. Sweet!

    The other site I want to use this on however is in full production with paying members etc and I’m concerned that the CDN tools looks like it’s using one container in RackSpace. Do I care about this? Is it OK to co-mingle multiple sites files within one container? These are a mix of wordpress and custom php apps. Thanks!

  9. Maybe I can manually edit the plugin to create and use another container in cloud files? :idea:

  10. If you some how could add a way for this plugin to use the Google App Engine as a CDN that would rock

  11. I am getting the timeout issue aswell and for some reason it gets to 98.75% and then just stops and does not continue >.< please look into this or respond to help fix this

  12. I too am getting nothing files not uploaded error, some are uploading others arn’t

  13. I too am having problems with both the error 202 unexpected HTTP response as well as the timeout issue. Our site is on Rackspace Cloud Sites as well and we can’t upload all of our media to Cloud Files as we should. I’ve used the plugin on different hosts and it works perfect, but after our move to Rackspace, we’ve been having some issues. Any idea what the problem may be?

  14. Just installed and received this warning:

    Warning: ini_set() has been disabled for security reasons in /my/sever/path/to/wp-content/plugins/cdn-tools/cdntools.php on line 27

    Is ini_set() required to be enabled to work with CDN Tools?

  15. Hi Paul, i’m also getting msg’s that some files failed to upload – it gets to about 99% then hangs. Any suggestion you have would be greatly appreciated.

  16. Hi,

    I have done all that’s mentioned here. Files are getting uploaded onto CDN but only partially. Many of my picture files, css files, etc are not getting uploaded onto CDN. Can you please help?

    Regards,

    Divyabh

  17. It would be awesome if you could get AWS S3 and optionally cloudfront up and running with CDN tools.

    S3/CloudFront is cheaper and is more widely utilized.

  18. Hey…

    Signed up for a Rack account here in the UK … entered API & User name and receive a incorrct user or api error. I guess you wrote this plugin for US Rack server only.. Any chance of telling me how to get it to work here on UK Rackspace servers?

    Many Thanks

  19. I think an update to Rackspace or WordPress has broken this plugin. It worked for me for a long time, but lately I have been getting the following errors:

    A file failed to upload. CDN Tools will behave inconsistently if all files do not upload successfully! You should contact the developer with this info:

    Fatal error: Uncaught exception ‘InvalidResponseException’ with message ‘Invalid response (): Unexpected HTTP response: ‘ in /home/public_html/godless.biz/public/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/cloudfiles.php:1050
    Stack trace:
    #0 /home/public_html/godless.biz/public/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/loader.php(105): CF_Container->make_public(172800)
    #1 /home/public_html/godless.biz/public/wp-content/plugins/cdn-tools/cdntools.php(267): cdn_loader->attachment_upload(‘/home/public_ht…’, ’0′)
    #2 /home/public_html/godless.biz/public/wp-content/plugins/cdn-tools/cdntools.php(283): cdntools->cdn_attachment_upload(’3361′, ‘/home/public_ht…’)
    #3 [internal function]: cdntools->cdn_attachment_upload_ajax(”)
    #4 /home/public_html/godless.biz/public/wp-includes/plugin.php(395): call_user_func_array(Array, Array)
    #5 /home/public_html/godless.biz/public/wp-admin/admin-ajax.php(1471): do_action(‘wp_ajax_cdn_att…’)
    #6 {main}
    thrown in /home/public_html/godless.biz/public/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/cloudfiles.php on line 1050

  20. Paul,

    I just updated wordpress to 3.1. It appears there is a conflict with cdntools 1.0 and latest contact form 7 plugin. It appears cdntools is sideloading the captcha images to cdn and causing the captcha images to come up with a missing image link. If you unload the files from cdn then the captcha image appears like it should. Please advise.

  21. I just upgraded to WordPress 3.1 and the CDN Tools plugin is interfering with the image uploader popup window. If CDN Tools is active, clicking the image icon to upload images does not bring up the window. If I turn CDN Tools off, the image uploader is restored. Right now I’m having to open the image uploader panel in a new tab, then turn off CDN Tools to insert images into posts, then reactivate it to serve images from the CDN.

  22. Hi,

    I’ve been asked to look at this for a client of ours. It looks great, but I was curious if I can add multiple directories that house images, not just the wordpress “upload” folder to the CDN?

    Also, how often do I have to press the “Load Files” button, or from the time I start it will it monitor all my directories and automatically push them to the CDN for me?

    Thanks,

    –d

  23. I’m having the same problem as Andrew Skegg above–it’s throwing an exception and I can’t seem to fix it! The stack trace points to line 203 for me, but that doesn’t even seem to be related here. HELP.

  24. Came looking for some help again, and realized I’d already been here….

    But nonetheless, it would be really nice if the “Load attachments” button didn’t go through every one of the images, and also if there were some sort of server-side script that would take care of this so I could run it like a cron. My client uses Windows Live Writer to post to her blog, and CDN tools won’t upload these images unless I go into the plugin settings, click Load, and wait about 7 hours. Not cool!

  25. The “crunching” bit takes a very long time. Is this due to the API interface?

  26. I posted sometime ago regarding DCN tools throwing an error. Well, I am glad to report that since I upgraded the server to the latest version of Ubuntu 11.04 (Natty Narwhal) he issue has disappeared.

  27. 20 Favorite Wordpress Plugins - light-weight and well-focused - pingback on September 4, 2011 at 11:47 pm
  28. Hi,

    Awesome plugin, it will help us a lot…

    Quick question/requirement. We have a site with more than 20K images. This can take days to load/upload with the “one-click” button.

    Is there a way to allow upload the files once the user request the image ? Basically this will priorize the upload of the most requested files.

    Also we notices that if we click on “Load Attachements” it start from scratch. I will suggest to continue with the images that have not yet been uploaded.

    Any plans for that ?
    Something we can help to code ?

    Thanks in advance

  29. I’ve edited your (awesome) plugin to support a CDN my own ftp, which is working great at the moment, with one small hitch that I cant seem to get around, and I’m wondering if you can point me in the right direction…

    Once I’ve uploaded a file and they copy to my other ftp, i’d like to delete those in the original directory (wp-content/uploads) and I cant figure out exactly how this can be done safely

  30. For everyone having problems, You should use the CDN settings that are included in W3 Total Cache if possible. W3 is the best cache solution, even better if you run your own VPS, Cloud or Dedicated server and can install xCache too.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

 

Trackbacks and Pingbacks: