Post Thumbs plugin | The Blemish

Post Thumbs plugin

This plugin allows you to generate thumbnails for each of your posts provided you have an image in the content of your post.

1.5 – 20061013
Fixed a couple of bugs dealing with cropping. Also added some new features. You can now specify a regex to check for a post that only has a video and specify a default image for it. Also, the function has been changed to tb_post_thumb($generate=false, $alt_text=”, $resize_width = 0, $resize_height = 0, $crop_x = 0, $crop_y = 0)


Haven’t you ever wanted to list most popular posts by a 50×50 thumbnail instead of just text? If you have an image from your server in your post content, this plugin will scan for it and convert it to a thumbnail for you to use. Note that the image must reside on your site. Currently it cannot grab images from a different domain (unless you modify it).


Upload the post-thumbs folder to your WordPress plugins folder and activate it from the dashboard. Navigate to the options->post thumbs and configure each option before using.

Important: You must configure the domain settings correctly or it may not work.

Domain name
Type in your domain name here without the http:// and without a trailing /. Example:
Full domain name
Your domain name including the http://, but still without a trailing /. Example:
Base path
This is an important one. Enter the base path for your site. This isn’t your URL. For me, this would be: /username/ (not that there is still no trailing slash). This one is real important because it’s needed to generate / save images.
Crop exact
Will crop the image to your exact width and height if either exceeds your defined values.

The rest of the options should be self-explanatory. Whichever image it finds on your server, it will create a new folder of your choice in the same directory as the image so make sure the folder is writable.


This plugin needs to be used in The Loop. You have to echo tb_post_thumb(). The function looks like this:

tb_post_thumb($generate=false, $alt_text='', $resize_width = 0, $resize_height = 0, $crop_x = 0, $crop_y = 0)

If you wanted to use your own image code, just use this in The Loop (you can also assign it to a variable and check if it’s empty or not which is what I do)
If you want the function to generate the image html for you
tb_post_thumb(true,'your alt text')
If you want it to also include alt text
If you want to override the resize with a new width / height
tb_post_thumb(true, 'alt text', 0, 0, 120, 20)
Will generate the image tag with the specified alt text and also crop the image exactly at 120px X 20px.

Feel free to mix and match the variables. If you specify the height as 0 or width as 0 in the options it will resize on the non-zero value. For example, you set resize height as 30, resize width as 0. It will resize it exactly to 30 height.