WordPress.org

Forums

Media.php help... (7 posts)

  1. Corse
    Member
    Posted 6 years ago #

    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]

  2. 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.

  3. Corse
    Member
    Posted 6 years ago #

    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);
    ?>
  4. 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.

  5. Corse
    Member
    Posted 6 years ago #

    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

  6. 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.

  7. C0nn0l2
    Member
    Posted 5 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic