Support » Fixing WordPress » Images attached to posts, size issue

  • Hi,

    Is it possible to set say if an image is bigger than a certain size then make it a set maximum size?

    e.g if a user attaches an image to a post that is massive and it messes the layout up is there an automatic way of shrinking it?

    Cheers, Mike

Viewing 8 replies - 1 through 8 (of 8 total)
  • If you’re using the img button to insert the image, you’ll end up seeing the html code for the link i.e. img src=”…” alt=”…”

    Just add another attribute inside the tags – width=”XXX”. I’ve done it before and used 640 – the pixel width I wanted, which worked fine for me using two sidebars and 1024×768 resolution. Don’t worry about height – your browser with scale it with the same aspect ratio.

    Note that the image download will be slower as your browser resizes the large image to fit the sixe you specify.


    This needs to be automatic but the main problem will be if the image is smaller than that width as it will become distorted, is there a way to set a ‘maximum width’ size rather than just a ‘width’ size?

    Thanks guys.

    Maximum width through css:

    You assign this to an img declaration in your stylesheet, typically nested under whichever class or id your posts are in. An *example* would be:

    #content img {
    max-width: 640px;

    Note that max-width does not work in Internet Explorer 6-. For ways around that:

    Thanks 🙂

    That sounds perfect. Will look into that.



    getting a little confused with the Internet Explorer fix, the FF one worked great.

    If I add this into the style sheet:

    p {
    document.body.clientWidth > (500/12) *
    “auto” );

    and then add < p > < / p > around the img will that work? Or is that only for text and not images? Or where am I going wrong?


    anyone? please.

    I’m not sure I completely understand what you’re after, but the width value would act upon the paragraph (p), and not the image. For that you would need to modify the declaration to:

    p img {


    All im looking for is the Internet Explorer version of that maximum width script.

    Thanks, Mike

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Images attached to posts, size issue’ is closed to new replies.