• Resolved gethyn1

    (@gethyn1)


    Is there any way to remove the height and width attributes from the rendered img elements?

    It would be great for the images to be able to scale proportionally within their parent container (e.g. max-width: 100%).

    The standard function I use for removing these attributes in WordPress seem to interfere with the plugin and stops the correct image being loaded.

    http://wordpress.org/plugins/picturefillwp/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author kylereicks

    (@kylereicks)

    I am having a little trouble duplicating the issue you describe. When I remove the height and width attributes from the image manually in the editor, Picturefill.WP behaves as expected, reproducing the image without the height and width attributes included. When the height and width attributes are included, max-width: 100%; in the CSS seems to constantly override them. Although to see this in action you first need to either add a <a href="https://github.com/kylereicks/picturefill.js.wp#wordpress-image-classes">min-size-*</a> class to the image, or override the media-query breakpoint with the <a href="https://github.com/kylereicks/picturefill.js.wp#filters">picturefill_wp_media_query_breakpoint</a> filter.

    If you can, please include the function that you use to remove the width and height attributes from images. It should help me duplicate the issue more precisely.

    Thanks very much

    Thread Starter gethyn1

    (@gethyn1)

    Thanks for the reply.

    I think I was trying to over complicate this issue by using a WordPress filter.

    I was having issues with the images not scaling vertically so they were becoming squashed. The simple addition of img {height: auto;} seems to have resolved the issue.

    Plugin Author kylereicks

    (@kylereicks)

    Awesome. Good work sleuthing out the answer, and thanks very much for reporting back with your solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Removing image height / width attributes’ is closed to new replies.