Jump to content

savetree

Members
  • Posts

    10
  • Joined

  • Last visited

Posts posted by savetree

  1. Thank you it now works with this code

    <?php
                header("Content-Type: image/jpg");
                $d = scandir('.');
                foreach($d as $f)
                        if(substr($f,-4)==".jpg")
                                $fs[] = $f;
                readFile($fs[rand(1,count($fs))-1]);

  2. I did. See my edit for my new code. Its still not working

     

    EDIT: This is what I added to the above post:

    This is the error

    Warning: Cannot modify header information - headers already sent by (output started at /home/savetree/public_html/avatarscript.php:1) in /home/savetree/public_html/avatarscript.php on line 2

    from this code

        <?php
                header("Content-Type: image/jpg");
                $d = scandir('.');
                foreach($d as $f)
                        if(substr($f,-4)==".jpg")
                                $fs[] = $f;
                readFile($fs[rand(1,count($fs))-1]);
        ?>

  3. where do I put it? It is already in the php script is it out of the php braces?

     

    EDIT:This is the error

    Warning: Cannot modify header information - headers already sent by (output started at /home/savetree/public_html/avatarscript.php:1) in /home/savetree/public_html/avatarscript.php on line 2

    from this code

        <?php
                header("Content-Type: image/jpg");
                $d = scandir('.');
                foreach($d as $f)
                        if(substr($f,-4)==".jpg")
                                $fs[] = $f;
                readFile($fs[rand(1,count($fs))-1]);
        ?>

  4. I have a php page that is supposed to load a random image from the folder it is in

        <?php
               error_reporting(0);
                header("Content-Type: image/jpg");
                $d = scandir('.');
                foreach($d as $f)
                        if(substr($f,-4)==".jpg")
                                $fs[] = $f;
                readFile($fs[rand(1,count($fs))-1]);
        ?>

     

    Why is this not working. I have checked that there are valid images, and i have seen this exact same script work on a personal server of the person who made it

    my domain name is savetree.heliohost.org

    this php is called avatarscript.php and is in the public_html directory

×
×
  • Create New...