0

I now have index.php in public_html with

include("/nfs/.../JohnDoe/contents/section1.html")

Then I have "section1.html" under /nfs/.../JohnDoe/contents/ and it has

<img src="/nfs/.../JohnDoe/contents/image.jpg">

and I put "image.jpg" under /nfs/.../JohnDoe/contents/. Then, the webpage does display "section1.html" but not "image.jpg."

Another thought might be that I can use

include("/nfs/.../JohnDoe/contents/image.jpg")

within section1.html. But then the question is "how can one set 'width' and 'height' of image.jpg this way?"

171124
  • 5
  • 2
  • By default, `include` can read files outside the webroot, although it's possible to disallow that in the settings. But I think `include` might not be the answer to your problem about *displaying an image* that exists outside your webroot. Does the solution suggested in [this question](https://stackoverflow.com/questions/8676144/reading-image-from-outside-public-html-with-php) solve your issue? – rickdenhaan Feb 14 '21 at 01:22
  • https://stackoverflow.com/questions/19979537/how-can-i-show-the-images-outside-the-web-root-directory-in-my-php-application/19979645 – Seth B Feb 14 '21 at 01:28
  • 2
    Does this answer your question? [How can i show the images outside the web root directory in my php application?](https://stackoverflow.com/questions/19979537/how-can-i-show-the-images-outside-the-web-root-directory-in-my-php-application) – Seth B Feb 14 '21 at 01:29

0 Answers0