Post thumbnail won’t scale proportionally
-
I’m trying to use featured image by using the_post_thumbnail. Whether I set the size by adding add_image_size in functions page or leave blank the image maintains a fixed height when sizing down. When I insert the image manually just pulling it from my cdn it sizes as expected. I can’t figure out why the height stays fixed causing the image to squish.
Am I missing something simple? I did find this code in a forum that does fix the issue but not sure this is the best fix
// Temp fix to remove fixed width and height on post thumbnails function remove_image_size_attributes( $html ) { return preg_replace( '/(width|height)="\d*"/', '', $html ); } // Remove image size attributes from post thumbnails add_filter( 'post_thumbnail_html', 'remove_image_size_attributes' ); // Remove image size attributes from images added to a WordPress post add_filter( 'image_send_to_editor', 'remove_image_size_attributes' ); // end temp fix
Any suggestions welcome…thank you
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Post thumbnail won’t scale proportionally’ is closed to new replies.