ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to keep EE from adding "width" and "height" to images in publish fields

June 30, 2011 12:42am

Subscribe [3]
  • #1 / Jun 30, 2011 12:42am

    Ryan Essmaker

    14 posts

    I’m working on a client site that I built using a responsive layout. By default, EE is adding “width” and “height” properties to images added to a post via a text area field. It’s imperative that EE doesn’t do this and I can’t find a why to prevent it. Am I missing something here or is there system file that I can edit to keep it from doing this? Thanks.

  • #2 / Jun 30, 2011 1:43am

    Rob Allen

    3105 posts

    I don’t know of a way you can turn that off, but your CSS should over-ride image size attributes anyway…

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

    Will constrain the image to fit inside it’s parent container, if smaller than the available space it will just show at it’s native size.

  • #3 / Jun 30, 2011 1:57am

    Ryan Essmaker

    14 posts

    Thanks for the reply, Rob! I’m using “max-width: 100%” but I don’t know why I didn’t think of “height: auto” to override the height. Guess I’m working too late into the night…

    I’d still love to keep EE from inserting the width and height if at all possible. Anybody know of a way?

  • #4 / Jun 30, 2011 3:49pm

    Sue Crocker

    26054 posts

    Thanks for the assist, Rob!
    Not that I’m aware of other than by hacking.

    You could make a feature request, or do what you’re doing right now, because other text areas might make sense to have it there. I can move this over to the Community Help forum for additional community support.

  • #5 / Jun 30, 2011 5:52pm

    Ryan Essmaker

    14 posts

    Thanks, Sue. I guess I’ll just stick with what I’m doing right now and make a feature request. It makes sense to have the option to override it.

  • #6 / Jun 30, 2011 5:58pm

    Sue Crocker

    26054 posts

    Sounds good. 😊 If anything else comes up, please do let us know in a new thread..

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases