WordPress.org

Support

Support » How-To and Troubleshooting » Media.php help…

Media.php help…

  • I have a problem with my images that are posted by visistors. WordPress is not scaling correctly to my theme’s width. Reading other topics the problem should be in media.php.

    Maybe someone can take a look on it.

    Thanx in advance.

    [contents of media.php removed]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    No need to post the media.php file. We have WordPress too, we can see it. 🙂

    Starting from WP 2.5, themes can specify the maximum width that an image should be in the main content area. To do this, just add this line to the theme’s functions.php file, right after the beginning <?php line:
    $GLOBALS['content_width'] = 800;

    Change 800 to the maximum image width you want, in pixels.

    I’m using a Dutch version of WordPress, maybe they changed something? Does this line scales the image corrrectly (exact dimensions)?

    I don’t have such a line in my functions.php

    This is my functions.php

    <?php
    if ( function_exists('register_sidebars') )
        register_sidebars(2);
    ?>
    Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    I don’t have such a line in my functions.php

    I know. That’s why I said to ADD IT to your functions.php. 🙂

    And yes, it will make it scale properly.

    It still doesn’t work.

    Could you tell me the exact line to add?

    This is the line i added:
    <?php $GLOBALS[‘content_width’] = 420; ?>

    Please check the effect:

    http://www.alfablog.nl/2008/10/31/de-alfa-mito-is-uiga-car-of-the-year-2009/#comments

    Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Your line is correct, however, adding it doesn’t magically change all your old posts. It only takes effect on new posts and new images.

    C0nn0l2

    @c0nn0l2

    otto i have attempted multiple methods. i am running wordpress 2.8

    i have posted new posts and uploaded new images each time. and edited functions.php in the wp-content/sliding-door/functions.php folder…

    i have added the line $GLOBALS[‘content_width’] = 800; in the following ways

    <?php $GLOBALS[‘content_width’] = 800; ?>
    <?php

    if ( function_exists(‘register_sidebar’) )
    register_sideba

    <?php
    <?php $GLOBALS[‘content_width’] = 800; ?>

    if ( function_exists(‘register_sidebar’) )
    register_sideba

    <?php
    $GLOBALS[‘content_width’] = 800;

    if ( function_exists(‘register_sidebar’) )
    register_sideba

    all to no effect…what am i doing wrong?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Media.php help…’ is closed to new replies.