Aqui está minha opinião sobre o uso de um dos filtros de imagem do wordpress, eu tentei usar o sugerido por Chip Bennett, mas não tive nenhum sucesso.
O que eu fiz foi criar um tamanho personalizado e, em seguida, verificar cada imagem como ela é criada se for esse tamanho específico e, em seguida, aplicar filtros phpthumb. Idealmente, gostaria de poder verificar apenas o nome do tamanho da imagem personalizada, mas ainda não descobri como fazer isso.
add_theme_support( 'post-thumbnails' );
add_image_size( 'rounded-saturated', 250, 100, true );
require_once('path_to\phpthumb.class.php');
add_filter('image_make_intermediate_size', 'paul_rounded_filter');
function paul_rounded_filter($file) {
$info = getimagesize($file);
// check for our image size and do stuff
if($info[0] == 250 && $info[1] == 100)
{
// create phpThumb object
$phpThumb = new phpThumb();
$phpThumb->resetObject();
// set data source -- do this first, any settings must be made AFTER this call
$phpThumb->setSourceData(file_get_contents($file));
$output_filename = $file;
// PLEASE NOTE:
// You must set any relevant config settings here. The phpThumb
// object mode does NOT pull any settings from phpThumb.config.php
//$phpThumb->setParameter('config_document_root', '/home/groups/p/ph/phpthumb/htdocs/');
//$phpThumb->setParameter('config_cache_directory', '/tmp/persistent/phpthumb/cache/');
// set parameters (see "URL Parameters" in phpthumb.readme.txt)
$phpThumb->setParameter('fltr', 'ric|30|30');
$phpThumb->setParameter('fltr', 'sat|-100');
// generate & output thumbnail
if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it!
if ($phpThumb->RenderToFile($output_filename)) {
// do something on success
echo 'Successfully rendered to "'.$output_filename.'"';
//die;
} else {
// do something with debug/error messages
echo 'Failed:<pre>'.implode("\n\n", $phpThumb->debugmessages).'</pre>';
die;
}
} else {
// do something with debug/error messages
echo 'Failed:<pre>'.$phpThumb->fatalerror."\n\n".implode("\n\n", $phpThumb->debugmessages).'</pre>';
die;
}
}
if ( $width || $height ) {
if ( !is_wp_error($resized_file) && $resized_file && $info = getimagesize($resized_file) ) {
$resized_file = apply_filters('image_make_intermediate_size', $resized_file);
return array(
'file' => wp_basename( $resized_file ),
'width' => $info[0],
'height' => $info[1],
);
}
}
return false;
}
Se você adicionar esse código ao arquivo functions.php do seu tema, faça o download do phpthumb e defina o caminho que você deve seguir. Eu tenho que trabalhar na minha instalação local do xampp, então espero que funcione para outras pessoas também. Os comentários do phpThumb são do exemplo simples de demonstração.