Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm running a family wordpress blog: http://www.kjirstiandtom.com

We have a lot of pictures we put up for family. I'm using the twenty-eleven theme, which I love. I did minor css edits to change colors and fonts, but it's otherwise pretty much stock.

Resizing works great... until you get really skinny (e.g. iphone screen). if you resize the browser window, you see that the pictures width starts to resize, but the picture height does not. Any tips?

Thanks!

share|improve this question
    
Interesting... Removing the inline height attribute in the image tag seems to solve the issue. I did also notice that your images don't have the default classes that images will generally have when inserted. I don't know if that is relevant, but an observation... –  Dan Feb 3 '13 at 6:29
add comment

2 Answers

Here is a quick function to remove the width and height attributes from images which should resolve your issue.

function _remove_img_dimensions_WPA84292($html) {
  $html = preg_replace('/(width|height)=["\']\d*["\']\s?/', "", $html);
    return $html;
}
//for new images
add_filter('post_thumbnail_html', '_remove_img_dimensions_WPA84292', 10);
add_filter( 'image_send_to_editor', '_remove_img_dimensions_WPA84292', 10 );
//for images already inserted into posts
add_filter('the_content', '_remove_img_dimensions_WPA84292', 10);
share|improve this answer
add comment

try to add CSS

.entry-content img { max-width: 100%; height: auto; }

This should set image height automatically and fix your issue.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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