Fun hacks, WP plugins, photography, and PKI junk. Languishing since 2008.
CDN Tools
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.8 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
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.
- CDN Tools Initial Release | >140 Characters
- WordPress Plugins: CDN Tools at WordPress Today
- Why You Need a Content Delivery Network
- 5 WordPress Plugins I Never Blog Without | The Blog Herald
- 5 WordPress Plugins I Never Blog Without | BLOGCHINA.ME
- RT @reaperhulk: CDN Tools v0.81 is out. Major upgrades to initial loading and more. If you have Cloud Files and WordPress swearingscience.com – Twitoaster
- Tech Blog — John Keyes – Linkeyes 19th May 2009
- Content Delivery Network | builder2
- Mosso: The Hosting Cloud » Blog Archive » Voice Your Opinion – Which Cloud Files Plug-In do YOU want?
- Cloud Hosting/Storage Toolbox: Options & Tools :: Graficznie
- 云托管/存储工具箱:选择&工具 | ⊹⊱⋛⋋ISong榮耀ζ組織™⋋⋛⊱⊹
- Top Gossips » Blog Archive » Cloud Hosting/Storage Toolbox: Options & Tools
- Wordpress 2.8 RC 1: Erste Eindrücke » Beitrag | Benjamin Vötterle » Bennis Welt
- Cloud Hosting/Storage Toolbox: Options & Tools | Opensource resources for web developers
- Cloud Hosting/Storage Toolbox: Options & Tools | rapid-DEV.net
- cdn tools 0.93 update — working | cloudplasma
- Installing Wordpress On Cloud Sites + CDN Support | Chad Keck DOT Com
- Using CDN Tools.. | A few words from little ole me..
- faster… – trouter.co.uk
- Rackspace Cloud Computing & Hosting | Make Your Websites Load Faster With Cloud Files CDN
about 3 months ago
Bug report: installing CDN tools (0.93 on WP 2.8.4) still ‘freezes’ the Visual | HTML tabs on the post editor. Workaround: if you need to edit HTML, disable the plugin and then click the tab. Once you re-enable the plugin the tabs will be stuck in whatever configuration they were before, so make sure you click ‘visual’ if that’s what you want for your default.
about 3 months ago
Great stuff – 0.94 seems to fix it – I can switch tabs and post with no issues now! Thanks!
about 3 months ago
Okay Paul… so I installed the plugin the first time…realize I need to open CDN acct with Cloud Files…do that…then plugin gives me error below.
“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 (0): Unexpected HTTP return code: 202
Click Okay to continue uploading, or cancel to abort.”
So now if the plugin won’t work…got to uninstall…cancel Cloud Files account…hope they don’t charge me…luckily they didn’t.
Then after doing all that…I decide to post my above “202 Error” issue…thinking of well…
I get an email back (thanks…) saying the 202 error issue is fixed. Not really excited about going through all the motions of getting another Cloud file account and trying again….but I did.
I cross my fingers when hitting the upload button…no luck. Same issue…202 popup comes up almost immediately…hit “OK”… to keep going…popup again…hit OK….popup again…hit OK….plugin counter gets stuck at 89.9%…
I’m not going to get crazy and delete my Cloud Files account like last time…I’d really like to get this to work….any help would be appreciated.
My sytem:
Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
PHP Version: 5.2.9
WordPress 2.8.5
with Wp Super Cache plugin running
about 3 months ago
Paul, thanks very much for your plugin. I decided to get a Cloud Files account after reading good things about it, and your plugin made hooking it to my site super simple.
I have a feature request/idea – instead of using the ugly CDN url given to me I created a cname – images.seo415.com – it would be sweet to be able to drop this into your code easily.
As it is now, lol, I don’t think my coding skills are strong enough to hack your code and get my url in there!
But anyways, I really appreciate your work!!
Charlie
about 3 months ago
It seems the upload path is derived from the wrong location. I get
“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:
Could not open file for reading: /users/home/dmalloc/domains/floozy.ca/web/public/wp-content/uploads/2007/05/img_0038.jpg
Click Okay to continue uploading, or cancel to abort.”
when that file is actually under /somethinghere/www/floozy.ca/htdocs/wp-content/uploads/2007/05/img_0038.jpg
about 2 months ago
Hi, I’m having the same problem as Guybrush Threepwood.
“The src urls aren’t being rewritten. They look like this
img src=”/image.png”
any ideas? I have the plugin disabled for now.
about 2 months ago
Hi there. Thanks for your time, I was unable to find another way to contact you so I am commenting. I am having the same issue as other people, and I can’t find a fix. I am using WordPress 2.8.6 and I just moved to a new webhost (and a new server). That new host is Rackspace Cloud, previous host was Bluehost.
The problem is that when I attempt to “Load File” I get that same error message about the failure to upload files. Upon inspection, the file path of the images matches that of my old host, not the new one. So of course those files aren’t there. So my question is how do I fix this? Thanks and let me know if you can. Much obliged in advance.
about 2 months ago
I got the exact Problem as Ariel Adams.
The Plugins tries to tear files from a subfolfer called ./wordpress/ which doesnt exist any more on new hosting.
Any hint on how to cure this would be welcome.
about 2 months ago
@ariel & thomas
I had the same problem. WordPress has a Search and Replace plugin for databases. You can find it here: http://wordpress.org/extend/plugins/search-and-replace/
about 2 months ago
Paul,
I got this error when trying to load files. Is there a fix? Does this require an account with mosso? Thanks. David
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 ‘SyntaxException’ with message ‘Missing required constructor arguments.’ in /home/content/p/g/f/pgfg891/html/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/cloudfiles.php:131
Stack trace:
#0 /home/content/p/g/f/pgfg891/html/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/loader.php(24): CF_Authentication->__construct(”, ”)
#1 /home/content/p/g/f/pgfg891/html/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/loader.php(19): cdn_loader->authconn()
#2 /home/content/p/g/f/pgfg891/html/wp-content/plugins/cdn-tools/cdntools.php(244): cdn_loader->__construct(”, ”)
#3 [internal function]: cdntools->cdn_attachment_upload_ajax(”)
#4 /home/content/p/g/f/pgfg891/html/wp-includes/plugin.php(339): call_user_func_array(Array, Array)
#5 /home/content/p/g/f/pgfg891/html/wp-admin/admin-ajax.php(1352): do_action(‘wp_ajax_cdn_att…’)
#6 {main}
thrown in /home/content/p/g/f/pgfg891/html/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/cloudfiles.php on line 131
about 2 months ago
Great Product!
One Issue after clicking Load Files I don’t get a js loaded and the it remains at 0.00% for eternity…
wordpress 2.8.6, safari 4.04
about 2 months ago
Dear Paul,
had to switch of your great plugin after running in similar trouble like pgfg (#77).
Got errors when deleting, uploading and trying to renew attachments on cdn server. Please find messages and Sys-Config below …
Cheers
cz
-
Linux steropes.providername.de 2.6.27.7-grsec #27 SMP Tue Jun 30 12:13:37 CEST 2009 i686
PHP 5.2.9
trying to upload to cdn (js alert):
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 ‘BadContentTypeException’ with message ‘Required Content-Type not set’ in /myserver/webroot/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/cloudfiles.php:1490
Stack trace:
#0 /myserver/webroot/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/cloudfiles.php(1804): CF_Object->_guess_content_type(‘/myserver…’)
#1 /myserver/webroot/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/loader.php(67): CF_Object->load_from_filename(‘/myserver…’)
#2 /myserver/webroot/wp-content/plugins/cdn-tools/cdntools.php(232): cdn_loader->attachment_upload(‘/myserver…’)
#3 /myserver/webroot/wp-content/plugins/cdn-tools/cdntools.php(245): cdntools->cdn_attachment_upload(‘986′, ‘/myserver…’)
#4 /kunden/gestaltderdinge.de/webseiten/zone_btism/bt in /myserver/webroot/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/cloudfiles.php on line 1490
—
after upload and crunching:
Fatal error: Uncaught exception ‘BadContentTypeException’ with message ‘Required Content-Type not set’ in /myserver/webroot/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/cloudfiles.php:1490 Stack trace: #0 /myserver/webroot/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/cloudfiles.php(1804): CF_Object->_guess_content_type(‘/myserver…’) #1 /myserver/webroot/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/loader.php(67): CF_Object->load_from_filename(‘/myserver…’) #2 /myserver/webroot/wp-content/plugins/cdn-tools/cdntools.php(232): cdn_loader->attachment_upload(‘/myserver…’) #3 /myserver/webroot/wp-includes/plugin.php(339): cdntools->cdn_attachment_upload(984) #4 /myserver/webroot/wp-includes/post.php(2561): in /myserver/webroot/wp-content/plugins/cdn-tools/cdn_classes/cloudfiles/cloudfiles.php on line 1490
about 2 months ago
The plugin just hangs at 0.00% and nothing is uploaded to the CDN. Anyone know how to fix this?
about 2 months ago
For everyone who has had the 0% error or BadContentTypeException, give 0.96 a shot. Some PHP installations are missing quite a bit of functionality CDN Tools needs, but I’ve hopefully worked around the issues.
about 2 months ago
Seems to be working pretty well for me, although I do hope Rackspace sorts itself out and starts supporting CNAMEs — I worry that when they do I’ll lose any Google Images ranking for my images. :E
One oddity I noticed is that when using the default WordPress theme, if you click through to an attachment page it doesn’t seem to use the CDN URL for the medium-sized image and the direct image it links to. However, switching to the legacy ‘Classic’ theme is fine.
I’m guessing the default theme uses some kind of special code for displaying its attachments, overriding whatever rewriting you’re doing. Something to look into, though hopefully when I write my own theme it won’t be an issue.
about 2 months ago
Hi Paul!
Just wanted to take a moment and thank you for developing this plugin and keeping it current.
Alex
about 2 months ago
Having briefly looked into the above issue a bit more, it looks like the ‘Classic’ theme doesn’t actually use an attachment.php at all. Can’t offer anything more than that at the moment though.
about 2 months ago
I have discovered that CDN Tools does not work if
\/* force SSL for the admin area */
define(‘FORCE_SSL_ADMIN’, true);\
is in the wp-config.php file. Your cdntools.php file, line 766, calls get_option(’siteurl’); which returns the non-ssl version of the site. If Wordpress redirects to the SSL version for the admin area, CDN Tools immediately fails for every file it tries to upload.
about 2 months ago
Fixed in 0.97
about 2 months ago
Thanks for the quick response. I’m a developer on Cloud Files. Send me an email if you run in to any issues or have any questions.
about 1 month ago
I continue getting this error on various images while attempting to load files-
A timeout on upload has occurred. Please contact the developer and provide them this information:
error
action=cdn_attachment_upload_ajax&(errors snipped)
Any help is appreciated!
about 1 month ago
When uploading posts via Windows Live Writer to Wordpress using publishing protocol the images get posted as /imagename which of course does not work.
Image gets uploaded to wordpress library but not to CDN.
about 1 month ago
How to create the API key?
searched all instructions. couldnt hear in video properly – is it manage.mojo.com? no such url.
please email me
about 1 month ago
no work: UnexpectedResponse Exception Unexpected response () in cloudfiles.php :206
dedicated box, have used amazonaws.com with w-3-total cache plugin successfuly
Regards, Jim
about 1 month ago
Hello, I receive the following error when attempting to load files:
http://pastebin.com/m164e7c1b
My config options for php is included in the pastebin.
Wordpress 2.9
CDN Tools 0.98
PHP 5.3.1
about 1 month ago
Paul,
Great plugin.
In WP 2.9 there is a new feature for post thumbnails:
http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/
Now, as best as I can see, these are not being replaced by CDN Tools. They’re still being pulled from the local site.
I suspect it’s no big deal but thought I’d flag that for you. Not had the time to look under the hood and sus it out in more detail.
Alister
about 1 month ago
Good catch. I had read a bit about this but forgot to look into it further. Provided that it’s not using some php file to dynamically resize the image, I’ll try to push these up to the CDN as well in a future release.
about 1 month ago
I’ve finally tracked down a bug that has been preventing me from using CDN Tools on my Windows server. Near the very beginning of cdntools.php change the following line:
$dir_array = explode(‘/’,dirname(__FILE__));
to
$dir_array = explode(DIRECTORY_SEPARATOR,dirname(__FILE__));
Under Linux CDNTOOLS_DIR_NAME gets set properly to ‘cdn-tools’ (default) but under Windows where the explode does nothing CDNTOOLS_DIR_NAME gets set to the full path. As one would expect chaos ensues later on when CDNTOOLS_DIR_NAME is used.
Thinking that any case of explode(‘/’ would need to be changed as well I tested that, but it seemed to break the upload. Changing only this one line seems to have fixed the issue when running on Windows.
Figured I’d better report this before you roll up to a full 1.0 release.
Thanks for this great plugin!
about 1 month ago
Got a little ahead of myself. Regarding the pathing issue and DIRECTORY_SEPARATOR, with the change initially reported that at least prevents the plugin from blowing up on the require(…). Upon further testing I think there may be even more cases where the DIRECTORY_SEPARATOR should be used instead of ‘/’…if I enable CDN Tools on a site with attachments already present and try to upload them is fails. What leads me to believe it’s a similar issue is that the windows path separator is missing from the error message. I get ‘C:inetpubmydomain.com/wp-content/uploads/…’ instead of ‘C:\inetpub\mydomain.com/wp-content/uploads/…’
about 1 month ago
I will investigate this weekend and see if I can’t track down all the instances. There are several locations where it makes assumptions regarding directory separator, including in the construction of the absolute paths it uses for uploading files (which would be where you ran into the newest issue)
about 1 month ago
Any fix yet for this problem:
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:
Could not open file for reading: example.com/image.jpg
about 4 weeks ago
How can we set the current path and url variables in the code…? that would fix it?
about 3 weeks ago
Hi!
First of all thanx for a great plugin!
I have a 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:
Could not open file for reading: /home/u12290/djkrypton.de/”
Server’s PHP version:
PHP Version 5.2.9
System:
FreeBSD 7.2-i386-20091008-RELENG_7_2 i386.
Thanx in advance!
about 2 weeks ago
Same here…
Could not open file for reading: /home/festival/public_html/wp-content/uploads/2007/11/dth_machmalauter.jpg
System: Debian Lenny latest
PHP-Version: 5.2.6-1+lenny4
The file as all others which could not be opend are present and working correctly if you call them via browser…
Is there any way to upload files by hand to rackspace cloud files instead of letting the plugin handle it?
Id love to spend some bucks if this makes this plugin work over here on my site.
about 4 days ago
Will CDN Tools work with a custom upload location? I’ve been using the plugin for a while now and it rocks. Thanks!
about 2 days ago
I agree with Robbie. We use Cloud Files for many website/blog.
This CDN Tools is almost perfect but upload location is too useless.
Create too many container is not a good idea. Why else we just create/select a container for upload all owner files?
wp-content folder = container
Easy and complex.
about 2 days ago
Custom upload locations will be supported (along with a single container) in 1.0.
about 5 hours ago
Thanks Paul.
about 5 hours ago
FYI – Hit a snag uploading a CSV file from the media library to Cloud Files. Got an error message and it said to contact the developer. Lucky you! It tried to create a container in Cloud files on its own rather than being imported into the appropriate year/month container. File did not upload although other non-images, such as pdf and ppt did just fine.