WordPress.org

Ready to get started?Download WordPress

Forums

Media Credit
Suggestion: Allow for responsive images with max-width (3 posts)

  1. I don't like having to edit plugins but this was a barrier toward fully fluid/responsive images for us. The absolute-value width in the shortcode output wasn't allowing images to scale properly.

    Might I suggest that instead of applying the image width in your output, apply max-width: 100% instead. I also tacked on height:auto as well.

    e.g.

    return '<div class="media-credit-container ' . esc_attr($align) . '" style="width: ' . (10 + (int) $width) . 'px">'
    	. do_shortcode( $content ) . '<span class="media-credit">' . $author_link . '</span></div>';

    Becomes

    return '<div class="media-credit-container ' . esc_attr($align) . '" style="max-width: 100%; height:auto;">'
    	. do_shortcode( $content ) . '<span class="media-credit">' . $author_link . '</span></div>';

    http://wordpress.org/extend/plugins/media-credit/

  2. Scott Bressler
    Member
    Plugin Author

    Posted 2 years ago #

    Without thorough testing I won't be able to re-determine why, but there was a very specific reason that I needed to put the width there. I assume it had something to do with padding/margins and background colors expanding properly.

    Can you post a link to your site where you have this hack in place?

    Thanks,
    Scott

  3. Scott,

    Here's a link to the page I've implemented this on: http://drewf.us/mtz

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by Drew Jaynes (DrewAPicture)
  • Latest reply from Drew Jaynes (DrewAPicture)
  • This topic is not a support question
  • WordPress version: 3.3.1