timthumb yada phpthumb ile de yapabilirsiniz. örneğin timthumb kullanırsanız resmi istediğiniz yerden cropladığınız için güzel bir görüntü elde edersiniz. Kullanım şu şekilde:
functions.php içine şunları ekliyoruz:
function show_thumb() {
global $post;
preg_match_all('/\< *[img][^\>]*src *= *[\"\']{0,1}([^\"\'\ >]*)/',get_the_content(),$matches);
$thumb = get_post_meta($post->ID, 'thumb', true);
if ($thumb) {
print '<a href="'.get_permalink($post).'"><img src="'.get_bloginfo('template_directory').'/timthumb.php?src='.$thumb.'&w=100&h=80&zc=1&cropfrom=middle&q=100" alt="'.str_replace('&', '&', $post->post_title).'" title="'.str_replace('&', '&', $post->post_title).'" /></a>';
} elseif (count($matches[1]) > 0) {
print '<a href="'.get_permalink($post).'"><img src="'.get_bloginfo('template_directory').'/timthumb.php?src='.$matches[1][0].'&w=100&h=80&zc=1&cropfrom=middle&q=100" alt="'.str_replace('&', '&', $post->post_title).'" title="'.str_replace('&', '&', $post->post_title).'" /></a>';
} else {
// nothing to do
}
}Şimdi temanın index.php yada archive.php yada category.php thumbnaillerin nerede görünmesini istiyorsanız o dosyayı açıp şu kodu ekliyoruz:
<?php show_thumb(); ?>
Bunun için temanın ana dizinine timthumb.php dosyasını koyuyoruz ve cache isimli klasör oluşturup izinini 755 ya da 777 yapıyoruz.
timthumb.php dosyasını buradan indirebilirsiniz.
http://timthumb.googlecode.com/svn/trunk/timthumb.php
Not: thumb kalitesi %100 ve kesim alanı orta olarak ayarlandı, resim yüksekliği 80px genişliği 100px bu ayarları kendinize göre değiştirin.