WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Media Credit] Suggestion: Allow for responsive images with max-width

[Plugin: Media Credit] Suggestion: Allow for responsive images with max-width

  • Drew Jaynes

    @drewapicture

    Docs Czar

    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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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

    Drew Jaynes

    @drewapicture

    Docs Czar

    Scott,

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Media Credit] Suggestion: Allow for responsive images with max-width’ is closed to new replies.