0

I'm trying to get my images inside the post may larger than 800px ;

For this I took a function that resizes image here and I'm trying to create a function to my thumb inside the post come with size that put to resize , more the problem is that is not resizing

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 );

Could anyone help me in this code please ?

0

Have you looked at using add_image_size? Check it out here.

It will allow you to crop images various ways. It will also allow you to use the standard the_post_thumbnail and pass it your custom image size when you go to output this on the front-end.

I also just noticed that you said inside the content. One way would be to take the above function and wrap it into a shortcode. Then you could pass the shortcode the needed arguments to output the correct size image.

  • The problem is that I am not able to call the function up in the code. – Luciano Oliveira Jul 24 '15 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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