0

I have searched around but I've found no simple way for doing this. I have themes I bought from ReadyThemes.com that all have timthumb as the image resizer. I would prefer to use Wordpresses default resizer, or something similar. I have seen people recommending to switch to the_post_thumbnail but I can't figure out how to do this. The suggestions aren't a one size fits all fix, and I don't want to butcher the code. Looking through my code, for example I found this:

<a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/custom/imgresize.php?src=<?php echo $image[0]; ?>&w=200&h=200" alt="<?php the_title(); ?>" /></a>

and this:

<a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/custom/imgresize.php?src=<?php echo $image[0]; ?>&w=60&h=60" border="0" align="left" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" /></a>

It calls the timthumb script with imgresize.php. Personally, I feel the best fix would be to replace all the code in imgresize.php with a way to call the_post_thumbnail, but I don't know how to do this.

What can I do to fix this?

3
  • How do you know that your server does not allow timthumb? Is this because the timthumb code does not work as expected or because of certain restrictions on your server? Dec 18, 2013 at 7:49
  • @Chittaranjan, on my server I block all direct access to php files that are not on the root directory. This is a very basic wordpress security enhancement. Dec 18, 2013 at 11:07
  • Are you doing this through any plugin or htaccess? Dec 18, 2013 at 11:57

1 Answer 1

0

Old Timthumb fan, i use Resize.php from Matthew Ruddy now

Usage :

$url = $imgSrc;      // Required
$width = 800;      // Optional. Defaults to '150'
$height = 600;      // Optional. Defaults to '150'
$crop = true;      // Optional. Defaults to 'true'
$retina = false;      // Optional. Defaults to 'false'
// Call the resizing function (returns an array)
$image = matthewruddy_image_resize( $url, $width, $height, $crop, $retina );

Check here : MatthewRuddy / Wordpress-Timthumb-alternative

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.