Results 1 to 3 of 3

Thread: document_root documentation

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default document_root documentation

    Hi, I am trying to find out more about $_SERVER['DOCUMENT_ROOT'] for example:

    <?php
    $image = $_SERVER['DOCUMENT_ROOT'].'/images/Council.jpg';
    $imageinfo = GetimageSize($image);
    echo "$imageinfo[1]<br>";print_r($imageinfo);
    ?>

    Will produce something like:

    300
    Array ( [0] => 400 [1] => 300 [2] => 3 [3] => width="400" height="300" [bits] => 8 [mime] => image/png )
    which is great for finding out information about an image, but when I look up the information on php.net all I get is:

    The document root directory under which the current script is executing, as defined in the server's configuration file.
    which just doesn't tell me much.

    any idea on how or where I can find out more? Most of the results are easy enough to figure out, for example:
    [0] = image height
    [1] = image width
    [2] = ?
    [3] = width and height together in a readable format
    [bits] = image color depth. (I think)
    [mime] = file type
    Last edited by james438; 03-20-2010 at 12:10 AM.
    To choose the lesser of two evils is still to choose evil. My personal site

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Sorry, this was a dumb question. $_SERVER['DOCUMENT_ROOT'] is merely a way of retrieving a file relative to the root folder as opposed to relative to the directory the script is running in.
    To choose the lesser of two evils is still to choose evil. My personal site

  3. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    did you find getImageSize(), though? very useful function. index [2] is a number corresponding to the image type, e.g., "3" means "jpg". Also, [3] is specifically designed to be used to output to <img> tags.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •