Are you afraid of what will happen to your blog should it get Digg slammed or suffer from the Slashdot effect? Have you seen your bandwidth usage rise along with the popularity of your blog? I have the solution to your problems.

When I wrote my article, Saving My Bandwidth and My Sanity, I was not aware that the Coralize plugin existed. I found out today.

In my article, I explained how to do it with the .htaccess file for the Apache web server. With this plugin, you don't have to worry about it! The plugin has the option to specify which social sites to preemptively coralize your whole site for.

There was one thing missing from the plugin, which I think I fixed myself. When a thumbnail linked to a larger image, the thumbnail would be coralized but the larger image would not. Here's the code I changed:

From:

//LOCAL IMAGES
if(get_option('coralize_imgs_lc')){
$preg_host = preg_quote($_SERVER["HTTP_HOST"], '/');
$content = preg_replace('/(\<img\s+.*?src\=["\']http\:\/\/'.$preg_host.')(\/.*?["\'].*?\>)/i', '$1.nyud.net:8080$2', $content);
$content = preg_replace('/(\<img\s+.*?src\=["\'])(\/.*?["\'].*?\>)/i', '$1http://'.$_SERVER['HTTP_HOST'].'.nyud.net:8080$2', $content);
}

To:

//LOCAL IMAGES
if(get_option('coralize_imgs_lc')){
$preg_host = preg_quote($_SERVER["HTTP_HOST"], '/');
$content = preg_replace('/(\<img\s+.*?src\=["\']http\:\/\/'.$preg_host.')(\/.*?["\'].*?\>)/i', '$1.nyud.net:8080$2', $content);
$content = preg_replace('/(\<img\s+.*?src\=["\'])(\/.*?["\'].*?\>)/i', '$1http://'.$_SERVER['HTTP_HOST'].'.nyud.net:8080$2', $content);
if (strpos($content, ".jpg") || strpos($content, ".gif") || strpos($content, ".png")) {
$content = preg_replace('/(\<a\s+.*?href\=["\']http\:\/\/'.$preg_host.')(\/.*?["\'].*?\>)/i', '$1.nyud.net:8080$2', $content);
$content = preg_replace('/(\<a\s+.*?href\=["\'])(\/.*?["\'].*?\>)/i', '$1http://'.$_SERVER['HTTP_HOST'].'.nyud.net:8080$2', $content);
}
}

The second "if" condition is the addition. If you want to try this, don't just copy and paste. The pretty single and full quotes here won't work and you'll have to replace them. You can send me an email message or ask for it in the comments and I'll send the changed plugin to you. I already forwarded the suggested additions to the author of the plugin.

I haven't been "dugg" since the plugin was put in place, so I can't guarantee the success of that part yet. If someone would like to digg this article and quite a few others would vote it up, I'm sure I could report on success or failure. That task, however, is up to you.

Update: Someone dugg me and it appears the plugin did not work, so I switched the .htaccess file and now it works again. The image caching does work with the plugin, so I have no idea why the digg protection doesn't. (I turned off the .htaccess until it appears a slam is in effect.)

***

Blog Appreciation:

One of my favorite blogs, that I never get over to enough, is DragonLady's World. I try to get there often, I really do, because I thoroughly enjoy reading the details she exposes about herself from time to time.