cynthie 0 Posted April 10, 2016 Report Share Posted April 10, 2016 Clicking around the Internet seems to state that images can only be accessed via http, and that I can't use php's 'include()' function to do it. . 1. I'd appreciate any suggestions for effective ways to access the images when placed one or two levels above/behind the root folder. . 2. Are there good alternate ways to pull up the images when placed in the regular images folder in front of the root folder, other than using http which means referencing them relatively or absulutely? . Thanks. - Cynthie Quote Link to post Share on other sites
daviddawn 0 Posted April 10, 2016 Report Share Posted April 10, 2016 HI Cynthie, http ( Hypertext Transfer Protocol ) is the technology that delivers the html ( Hyper text markup language). so, you would write the source for the image using the img tag in html, then use the php fuction include to include that html file. do you have sound knowledge of html ? Quote Link to post Share on other sites
cynthie 0 Posted April 10, 2016 Author Report Share Posted April 10, 2016 1. Thank you so much, DavidDawn, for your response..2. Yes, I have a basic enough knowledge of HTML and PHP..3. For example, my www or document root is /home/cynthie/public_html/wish/ and from a file on the same root I could simply say <img src="beautifuljulie.jpg" /> or on the browser I could type http://www.wishtimer.com/beautifuljulie.jpg but one of the security suggestions in Effortless e-Commerce is to try placing some files or images one step below/behind the root folder, which in my case would be /home/cynthie/public_html/ which, with the image would give me this: /home/cynthie/public_html/beautifuljulie.jpg So, how do I access this file (beautifuljulie.jpg) from a file in the root folder, whether a php or html file?Thanks again. - Cythie Quote Link to post Share on other sites
Larry 428 Posted April 11, 2016 Report Share Posted April 11, 2016 David had provided the answer (thanks, David!) but to provide a bit more detail, your IMG SRC value would be something like show_image.php?id=X. The show_image.php file would validate the ID value (probably against a database), find the image file on the server, and then provide the image itself. This is known as a proxy script. I think there's an example in the book for serving PDF files. Quote Link to post Share on other sites
cynthie 0 Posted April 11, 2016 Author Report Share Posted April 11, 2016 Thank y'all for the replies. I'll try your suggestions and if I still run into road-blocks I'll let you know. Quote Link to post Share on other sites
cynthie 0 Posted April 12, 2016 Author Report Share Posted April 12, 2016 I wish to say that I spent a bit more time with the book, paying particular attention to the 'view-pdf.php' script which begins on page 144, and it finally sank in. I get it now; it all makes sense what you all said in the replies, and I could nicely place a jpg file behind my root folder and pull it up just like that! Thanks again. I'm a huge fan!! - Cynthie. Quote Link to post Share on other sites
Larry 428 Posted April 12, 2016 Report Share Posted April 12, 2016 Wonderful. Glad to hear it and thanks for the nice words! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.