Page 1 of 1

functions/includes

Posted: Fri May 02, 2003 12:35 pm
by dlibby
I am fairly new to PHP. And I have searched high and low for information on this problem and since I haven't had any luck anywhere else and don't seem to have anyplace else to turn at the moment I thought I would give this a try. I believe it is probably a simple problem but....

So that being said:

I have a website. I have put a membership search on this website. You search by First and/or Last name. (No problem there). If there is a match in the mssql database you get the results displaying 5 at a time, showing their User Id#, First Name, and Last Name. The User Id# is hyperlinked so if you click on it it will bring you to a detail page that contains more information about this particular member. (No problem here either).

My problem kicks in when I am trying to link the User ID# to an image of them in a folder located on the same Drive as the website but not in the Web itself. Does anyone know how I would go about searching a folder with images in it that are named the same as the User ID#'s, and displaying the corresponding photo along with all the other information I have pulled up from the database?? I have tried several things and so far nothing has worked. I have been to several hundred places looking for answers, and so far no luck. Any help with this would be more than greatly appreciated. Thanks in advance. :?

Posted: Fri May 02, 2003 4:06 pm
by twigletmac
Could we see the code you're currently using?

Mac

Posted: Fri May 02, 2003 4:06 pm
by hedge
If I understand you correctly you need to display an image that is not in the web root. If so you can do it like this:

Code: Select all

-- html
<html><img src="getpic.php"></html>

-- getpic.php
<?php
 header("Content-Type: image/jpeg");
 file(<path to file>);
?>
?>

Posted: Fri May 02, 2003 5:39 pm
by volka
readfile() instead of file()