Archive for the “Site News” Category

As I was previewing my previous entry, I noticed that the thumbnails that WordPress had created for the attached [jpeg] images were of rather poor quality—they exhibited significant compression artifacts—and they were a little smaller than I would have liked.

The latter problem was a simple fix. The Shift This WordPress Thumbnail Size Plugin creates a new configuration page that allows WordPress admins to specify the max dimensions for thumbnails. (I use 192px.)

The problem of poor jpeg thumbnail quality isn’t as clean to fix. The only solution I could find requires changing a line in the source code. As explained here in the WordPress support forums, the fix requires editing the wp_create_thumbnail function in wp-admin/admin-functions.php.

The following code takes the resampled image data and saves it as a file on the server.

// move the thumbnail to its final destination
if ( $type[2] == 1 ) {
	if (!imagegif( $thumbnail, $thumbpath ) ) {
		$error = __( "Thumbnail path invalid" );
	}
}
elseif ( $type[2] == 2 ) {
	if (!imagejpeg( $thumbnail, $thumbpath ) ) {
		$error = __( "Thumbnail path invalid" );
	}
}
elseif ( $type[2] == 3 ) {
	if (!imagepng( $thumbnail, $thumbpath ) ) {
		$error = __( "Thumbnail path invalid" );
	}
}

The following line from the above code handles jpeg images:

if (!imagejpeg( $thumbnail, $thumbpath ) ) {

The imagejpeg function can take a third argument that specifies the quality (0–100) of the resulting file. If that argument is not provided, it defaults to a value of “about 75” (according to the PHP manual). I think a value of 90 is more appropriate, so therefore I edited the above line to:

if (!imagejpeg( $thumbnail, $thumbpath, 90 ) ) {

The result is greatly improved; however, as the comparison below demonstrates, it’s still not quite as nice as what I can get using the application that I’ve been using for years to do thumbnails manually—ThumbsUp. The reason is that ThumbsUp provides options for antialiasing and sharpening the thumbnails that it generates.

Example ThumbnailGuitar Hero Cover
Left: WordPress-generated thumbnail (after applying the above hack)—clean, but kinda fuzzy.
Right: thumbnail generated using ThumbsUp—nice & sharp.

Incidentally, the thumbnails on the previous post were all generated using ThumbsUp (to replace the ones that WordPress had originally generated with all the compression artifacts). I had hoped the above hack would keep me from having to do that again; however, it looks like I may have to continue using ThumbsUp as my source for thumbnails.

Comments 8 Comments »

I haven’t blogged in months. I’ve been promising a redesign for ages. Well, the time for action is here. This summer SteveJamieson.com is getting a complete overhaul. So please excuse the mess. I’ve got a blog engine transition to do, databases to upgrade, a photo gallery to install, and templates to design.

Design Preview

[update – 5/28]:

The move of my blog posts from Movable Type to WordPress was quick, simple, and painless. Unfortunately, the Textile (formatting) plugin for WordPress doesn’t seem to support all the shorthand mark-up that the Movable Type plugin does, so I have to reformat all my posts in standard HTML. I also moved my old blog image directory on my server to keep things tidy, so I have to edit all the image URLs as well. On the plus side, this is giving me the opportunity to file everything into categories. Keep an eye on the Uncategorized category to see my progress.

Comments 2 Comments »

If you tried visiting my site in the past 24 hours you probably received a 403 Forbidden error. Last night I was apparently on the receiving end of a ginormous referrer spam attack. What’s a referrer spam attack, you ask?

Here’s how it works. Whenever you attempt to visit a web page, your browser sends an HTTP request to the server, which specifies the file that you want as well as some other information about your browser and such. If you request a page by clicking on a link, the URL of the document containing that link is sent in the HTTP request. Web servers log these HTTP requests and then log analysis tools can generate statistical reports.

My stats have been publicly available (if you knew where to look), and one of the parts of the reports is top referrers, so I can see where traffic to my site is coming from. The addresses in the referrer report are live links, so when Google’s web crawler indexes my site, it sees these top referrers as sites that I have linked to, which increases their PageRank score. Therefore, if a devious individual can have a bunch of zombie computers make a bunch of bogus HTTP requests with the perpetrator’s site as the referrer, this nefarious person can get a link to their site on mine and thus increase their web site’s rank in Google searches (or perhaps more likely the weight that Google gives to their site when determining the rank of the pages that others may pay them to link to).

I’ve known that this sort of thing has been going on for some time, but the referrer spam that I’ve seen has always been rather light—just a small (though not insignificant) percentage of the traffic on my site. Last night, however, my server was being hit so hard that the server was being overloaded and my web host had to block all web access.

You’ll notice that web access has been restored, although, for now, only if you enter the address directly. Referred traffic is still blocked, so trying to access my site from a link on another site will still be blocked. Perhaps I’ll go in and unblock some of the legitimate sites that I know link to me.

Comments 3 Comments »

I am seriously geeking out today! Last night I installed MediaWiki on my server—the software that runs Wikipedia and the other Wikimedia Foundation projects. I’ve edited one article on Wikipedia, but being able to mess around with my own installation has really opened my eyes to just how slick this software is. The markup for formatting text is easy to learn. The template system for creating reusable text blocks and dynamic text patterns is amazing. The management tools are impressive. I’m just scratching the surface, so I can’t wait to see what I discover next.

Anyway, I present my wiki: SteveWiki

Comments 1 Comment »

Nick commented to me today about how I’m a big proponent of RSS technology, and yet my blog doesn’t have an RSS feed. Indeed, it is a travesty that I do not have an RSS feed while I read other blogs exclusively in RSS. An RSS feed has long been on the list of site enhancements that would be included in that site redesign that I’ve been working on for many ages now. However, that doesn’t look like it will be done anytime soon, so I thought maybe I should take an hour, figure out RSS syntax, and publish a feed already.

Thus I present to you: My RSS Feed. Subscribe away!

Comments 2 Comments »