Modifying image size within wordpress content

0

For friends who understand wordpress, could you give me a hand? I need to modify the size of the images within my content, image within the posts.

I took a resize function here and it works fine, my difficulty is to use this function within my functions to resize the thumbs within the post.

I tried to elaborate a function but it is not working, could someone tell me how to function this function?

function resizeThumb($html, $post_id, $post_thumbnail_id, $size, $attr){
$image = get_post_thumbnail_id();
$thumb = vt_resize( $image, '', 850, 600, true );
$html = '<img src="' . $thumb[url] . '" alt="' . $alt . '" class="img-responsive" />';
return $html;
}
add_filter( 'post_thumbnail_html', 'resizeThumb', 10, 5 );
    
asked by anonymous 23.07.2015 / 20:40

1 answer

1

Hello! Have you tried using the set_post_thumbnail_size() function of wordpress?

add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 150, 150, true ); // width, height, crop

link

I suppose it should serve what you want.

    
30.07.2015 / 14:48