Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP web image displayer

Options
  • 05-10-2002 2:19pm
    #1
    Closed Accounts Posts: 157 ✭✭


    Hi ,

    Does anyone know where I can find a script in PHP that opens images and displays them on a web page..

    like http://site.com/image.php?file=/images/image.jpg

    any help would be greatly appreciated..


Comments

  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Hi halfab,

    Do you mean a script that will wrap HTML around an image from within DOCUMENT_ROOT, or a script that will pull an image from below DOCUMENT_ROOT and output it, to prevent leeching?

    adam


  • Registered Users Posts: 849 ✭✭✭Cr8or


    duno if this is what your looking for but i hope it helps yea out ...

    this dosent open the file (as in server side just in the browser)

    putting it below the below the document root would be a bit harder would involve reading the file and outputting it to the browser ...

    all you would have to do is:
    http://site.com/anyfilename.php?id=/images/pic1.jpg


    [PHP]
    <?php

    if (isset($id) && is_file($id)) {
    echo "<img src='$id'>";
    }

    ?>
    [/PHP]


  • Closed Accounts Posts: 157 ✭✭halfab


    dahamsta , I dont mind image leeching from the site .. but yea to wrap html around the image from within document_root and display it in a new window ..


    Cr8or , that might be the ticket.. if I added my own html around that echo command like

    echo "<table><blah what ever html I want> ";
    echo "<img src='$id'>";
    echo "</blah what ever html I want></table> ";

    would that script work?... and if so how would I go about opening it in a new page ..


    cheers for the fast response guys..


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    would that script work?

    Yip, cr8or had it in one. To add to that, you can cut out some of the PHP code if you use "here printing":
    echo <<<END
    <table>
     <tr>
      <td><img src="$id">
     </tr>
    </table>
    END;
    

    But it's entirely up to you.

    and if so how would I go about opening it in a new page

    Just link to it?

    adam


  • Closed Accounts Posts: 157 ✭✭halfab


    cheers ..

    thats great now..


  • Advertisement
  • Registered Users Posts: 849 ✭✭✭Cr8or


    np ;)


Advertisement