Resize images within the post
-
Hello friends , I have a problem in wordpress I can not solve !
I need all the images from within the wordpress post are resized to a standard size .I tried to create a function to it, the more it seems to me that did not work or is not working .
I have a function that makes scaling the image to a suitable size , I found this function on github this one and created the following 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 . '"'; return $html; } add_filter( 'post_thumbnail_html', 'resizeThumb', 10, 5 );
It is not correct , so I’m asking because I’m learning to “program” WP pair now .
Could anyone help me with a solution for this?
- The topic ‘Resize images within the post’ is closed to new replies.