carlg Posted January 19, 2008 Share Posted January 19, 2008 I have an include file which is in my main directory. I have a file in a sub dir that includes this file. so I have ini_set (include_path, "../"); include ("myfile.php"); myfile.php lives in ../ which is the parent dir myfile.php includes some <img> tags, but th images are not being found since they are in another dir How do I fix this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/86818-images-in-include-files/ Share on other sites More sharing options...
carlg Posted January 19, 2008 Author Share Posted January 19, 2008 OK, maybe I need to word this better. My directory structure looks something like this $DOCROOT/includes $DOCROOT/myfiles I made the banner for my site and called it banner.php. It resides in the includes subdirectory. banner.php has some img tags within the code and I include banner.php in all of my php pages. I have a file in myfiles called mypage.php and it includes banner.php. All of the text from banner.php is showing up perfectly fine but all of the images are not there. If I call up a file that is in the DOCROOT that has banner.php included, the images show up fine. Hope I'm more clear thanks carl Quote Link to comment https://forums.phpfreaks.com/topic/86818-images-in-include-files/#findComment-443892 Share on other sites More sharing options...
pkSML Posted January 20, 2008 Share Posted January 20, 2008 Can you use an absolute path to the images? If you're using relative URLs, that might make things get hairy. You could also use absolute paths relative to your docroot. Call the image like so: <img src="/images/whatever.png"> This will look in docroot/images/ for the file. Make sense? Quote Link to comment https://forums.phpfreaks.com/topic/86818-images-in-include-files/#findComment-443921 Share on other sites More sharing options...
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.