SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot Tekdot's Avatar
    Join Date
    Jul 2005
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    loading image outside www dir

    I have a set of images outside the public_html/ directory. But when I try to call them with img src using "../pics/picture.jpg" or even using "/absolute/path/picture.jpg" it wont let me access anything above the public html dir.

    So is there any way I could "open" it using like file i/o, then "echo" it into the browser?


    Or any other ideas?
    Need a large site moved (5 GB +)? I can help, PM me for pricing.
    [PR 4] Large File Hosting Site looking for link trades

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You can't do that directly. But you can use a php script to read the image and output it to the browser:
    PHP Code:
     Header("Content-type:image/jpeg");
    readfile("path/to/image.jpg"); 
    Last edited by php_daemon; Aug 18, 2006 at 17:35.
    Saul


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
  •