WordPress.org

Ready to get started?Download WordPress

Forums

Image Max width set with $GLOBALS['content_width'] is being applied to height (3 posts)

  1. gmisen
    Member
    Posted 4 years ago #

    So this is confusing me.
    I've set my thumbnail and medium size images through the dashboard, and,

    because I want all my images at full size to be scaled down (if theyre originally bigger) to a 500 pixel width, with no limit on how tall they are,

    I put this code at the top of my functions.php file:

    <?php $GLOBALS['content_width'] = 500; ?>

    which worked great until todays post had a vertical image. At full size it's height was limited to 500px, leaving the width at 375 and too skinny and funny looking inside my design expecting it to take up 500px width.

    i specified content_WIDTH did i not? why is it applying it to height?

    or is the code above not what I was supposed to do?

    Any help would awesome! Thanks!!

  2. gmisen
    Member
    Posted 4 years ago #

    anybody been confused by this before?

  3. gmisen
    Member
    Posted 4 years ago #

    if anyone else finds this, i figured it out after digging around some more.

    set <?php $GLOBALS['content_width'] = 500; ?> in functions.php

    then comment out line 84 in media.php:

    // any other type: use the real image and constrain it
    // list( $width, $height ) = image_constrain_size_for_editor( $meta['width'], $meta['height'], $size );

    and the WIDTH is set to 500 and not just the longest dimension. ta da!
    got it from parisoto's reply here:
    http://wordpress.org/support/topic/164667?replies=29

Topic Closed

This topic has been closed to new replies.

About this Topic