访问文档根目录外的文件 - 我能够压缩 - 无法显示

I have some images saved separately in folder outside the document root.

I write a program to zip those images using ZipArchive();

the php file is running inside sub folders of my document root.

i just give the outside image path as an array and pass it to zip object and works fine

$imgList = array(
    '/OUTSIDEFOLDER/img1.jpg',
     '/OUTSIDEFOLDER/img2.jpg'
);

same path i used to display the image in

<img src='/OUTSIDEFOLDER/img1.jpg'>

this is not working. What i am doing wrong . Is it a limitation of image source or

i have to look any config htaccess settings

The document root specifies what parts of your server's file system is available to be served up by the webserver.

If you could just specify any path you wanted, anyone could steal anyfile they wanted from your server, etc..

To serve something from outside the document root, you'll have to

  1. create an Apache alias that points to the file, so it effectively becomes "inside the document" root
  2. Create a filesystem symlink inside your document root that points to the external file, and make sure the webserver allows such symlinks and follows them
  3. Use a script (e.g. php) to serve up the file.