Skip to content

WordPress 2.9 – the_post_image

wordpress-logo-torn-paperIt was recently announced that WordPress 2.9 includes a new function to get post images called the_post_image. There is some information about the command over on WPEngineer.

Having post thumbnails is fantastic, they really liven up a post, but until recently one of the best ways to do this was to use my image resize script, TimThumb. Loads of sites use it, but now that the_post_image function has been announced it may become redundant.

Initially I thought it was great – it will make WordPress theme authors lives easier – but after mulling it over I realized there are some fundamental features missing:

  1. It uses WordPress statically generated thumbnails – there’s nothing dynamic – which means you are restricted to certain sizes.
  2. The size restrictions mean theme authors need to design with those sizes in mind, creating artificial design limitations.
  3. The image sizes can be altered via the WordPress admin, which means they can not be relied upon by theme devs to work consistently – again making theme design harder.
  4. The script only looks at the attached images and ignores those embedded in the content (which is something Mimbo Pro, Elemental, and a variety of thumbnail plugins take care of)
  5. It doesn’t crop the images, only resizing them, which could lead to some unpredictable results when there are very wide or tall images.

Don’t get me wrong, I think the addition is fantastic, especially for those who don’t want to spend time working out how to do it the ‘hard’ (aka custom) way, and I am sure many will use it. However from a personal point of view I will be taking the function apart to see what I can learn, but within my themes I will continue using a combination of my custom code and TimThumb.



Ben View All

Ben is a lifelong Nintendo fan who also likes to build websites, and develop games. He also buys way too much Lego.

16 thoughts on “WordPress 2.9 – the_post_image Leave a comment

  1. Strange that they didn’t design something to be expandable eh?

    It’s a mega bummer that WP is getting so bloated with weird things lately. I wish they would start it all over again, vanilla fresh & clean things up.

    • I think they are too far along to be able to start things again, but it would be nice if they spent a couple of versions simply tidying up and optimizing all of the code (front and back end). The software itself does everything I need, so speeding it up and polishing the way it works are the top of my personal feature lists.

  2. Agreed. Though it’s a nice feature, the dynamic PHP resized scripts work real nice for custom development themes, and designs.

    • Yeah – I’m sure there are people who will use the new script, but for me it’s not practical. Perhaps for my own designs, but for ones I give away/ sell I think I need more control to make sure they work as intended.

    • Hey John – I hadn’t seen that, thanks for pointing it out. The code looks interesting but doesn’t really fix the issue I have. I want to be able to set the dimensions when I call the the_post_image so that the image is resized and cropped to fit my requirements. Unless I misunderstood it – that patch seems to be simply rebuilding the previously generated thumbnail images.

  3. I really don’t see the point of using Automatic resizes. Its a quick and dirty way to post however, how does the script know what to crop out ๐Ÿ™ ?

    Cropping is always something that the post author should take care of. Then perhaps, include it in the post and then display with the_post_image.

    I think its decent and a great new addition !

    • I can totally understand your point of view, and for some that’s the way to go, but personally I like the ease of use of the automated thumbnails. I like not having to worry about creating multiple images for multiple scenarios. I like being able to change my design and not having to go through and recreate all the thumbnails. In face I recently redesigned my blog, adding automated thumbnails and the icons “just appeared”, even though I had never set any before. I think that’s pretty awesome ๐Ÿ™‚

      • If you’re going to need a custom size (say ‘ben-custom-post-image-size’) then just hook into the appropriate WordPress filters. You’re not forced to use the default of small, medium, large, and full. You can use other sizes if you want to.

        Just throw the hooks into your theme’s functions.php file and you’ll have no problem ๐Ÿ™‚

      • Hey Nick – that sounds quite interesting, I am going to have to look into that. Does that mean the code will resize the images in real time if they don’t exist?

  4. Pingback: Everything you need to know about WordPress 2.9’s post image feature
  5. Pingback: Everything you need to know about WordPress 2.9โ€™s post image feature « Creative Internet Architect
  6. Hey,
    just wanted to point out a few things.. with the 2.9 post thumbs feature you can create as many different sizes as you need and call them wherever you want.. You can also set if it simply resizes the image or hard crops it..

    I’m digging this new feature a lot and use it all over my site. I also have a post outlining how to set up a theme to support it.. if you want to check it out you can by reading my post Upgrade Your Theme To Support WordPress 2.9 Post Thumbnails

    have a great weekend ๐Ÿ™‚


Leave a Reply

Your email address will not be published. Required fields are marked *