8 thoughts on “Simple WordPress Post Thumbnails with Regular Expressions Leave a comment

  1. This is great combined with a script that will automatically crop the image. Forcing the resize of the image in html/css will make the image ugly.

  2. hai Ben,
    though this might sound silly…
    if one of my posts which using timthumb to generate thumbnail image as default but didn’t have any image in it, how am I going to replace it with other image?

    thanks..

    1. currently there is no way to do default images with TimThumb, you would need to build it into your theme. I have added a quick snippet to the article above to show how I would do this 🙂

  3. WRT Lucian’s post. If an image is already the correct size, the server will still try to resize / crop it, and will blur it. CSS resize gives much better results as far as sharpness and crispness goes.

  4. It would be better to define the default image at the start, instead of an empty variable:

    // get post content
    global $post;
    $content = $post->post_content;

    // set default image value
    $theImageSrc =’path/to/default/image.jpg’;

    ….

  5. Pingback: 50 Unique and Informative wordpress tutorial showcase | DumasLab.com

Leave a Reply

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