Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Image Resizing. TimThumb Alternative? Post Thumbnails? WordPress


Hi There,

I'm working with a Wordpress theme that is using the PHP TimThumb script to generate auto-thumbnails. The script is great, but it requires changes to the web server (folder permissions, etc) and it ends up being a bit of a hassle for the end users.

I am looking for an alternative to the TimThumb script for generating thumbnail images.

I started playing around using Wordpress' built in post thumbnails + custom image sizes, and this works really well, but the problem is that not all the images that need to get re-sized are post thumbnails.

The theme contains some custom shortcodes that allow users to insert an image anywhere in the site. The shortcode resizes the image and adds a stylish border around it. The user is required to input the URL of the image, ie:

Ideally I would love to use the Wordpress built in image resizing.

Is it possible to use the built in resizing script on regular images that aren't post thumbnails? (ie in the custom shortcodes outlined above). If not possible, are there any solid alternatives to the TimThumb Script? I'm looking for a "bullet proof" method that works just as well, and won't require the user to make any changes on the server.

Thank you in advance for your help.


Answers (4)


Denzel Chia answers:


You can always use get the image plugin by Justin tadlock.

If you need me to setup an example for you, just drop me an email.
Just tell me where and how you want to use it.


WP Answers comments:

This looks very promising.

I'm just curious, does this work with Post-Thumbnails? I see that it searches for images within the post, or searched for custom fields, but I was confused if it works with post thumbnails as well? Currently my theme requires users to set a Post Thumbnail (or featured image its called now) on blog posts. Will this script resize those as well?

Denzel Chia comments:


For example you want to use the Feature Image, but for another location with a different image size.
After add_theme_support('post_thumbnails');
add the following, this will generate a image size home-thumbnail with size 180 x 240.
If you want it to crop, just set the last variable to true.


/*set image sizes*/
add_image_size( 'home-thumbnail', 180, 240,true); //crop

Usage on template.

$home_thumbnail = get_the_image( array('image_class'=>'attachment-home-thumbnail', 'size' => 'home-thumbnail','echo'=>false,'link_to_post'=>false) );

<?php echo $home_thumbnail; ?>

Is this something you want?



AdamGold answers:

Sorry, I am in a rush so didn't fully read your message but here's a great alternative to TimThumb:


WP Answers comments:

This looks very promising.

Just curious how this gets implemented? I mean I know I would add the functionality to the theme via functions.php, but where do you specify image sizes for output?

For example, this is what a piece of code currently looks like using TimThumb. How would this translate using that plugin?

<img src="'.FUNCTIONS.'/thumbs.php?src='.$image_path.'&amp;h=241&amp;w=443&amp;zc=1" alt="'.$description.'" />

WP Answers comments:

Just noticed the server needs PHP 5.2+

This could potentially be an issue for some end users. Hmm...not sure though.


Satish Gandham answers:

Use this plugin developed by me

WP Answers comments:

Looks great. I just have the same question as above. Just curious what the string would look like in place of TimThumb.

(please refer to my comment above)

WP Answers comments:

Just curious, what are the server requirements for this script? IE PHP version?


Rashid Aliyev answers:

Why You just not use it on Windows hosting, or write PHP script that will give additional permission while installing?
Can help with PHP permission writing.

WP Answers comments:

Hi There,

Well it's not only permissions. Sometimes certain hosts, such as HostGator, require mod_security rules be added to the server in order for TimThumb to work.