Fuzzy Wobble Posted August 21, 2007 Share Posted August 21, 2007 Ok guru's. I am new to php and having some troubles with something that should be relatively simple. I am trying to read an image file from a directory and display it in an html table. The catch is, the directory is not a set variable because it depends on the user who is logged in . this directory is called "$imagedirectory" below and is passed through a SESSION. for example $imagedirectory = "/htdocs/page/members/johnny_tracks/images/imagefile.jpg" the area of concern is highlighted below <img src=\"$imagedirectory\"/> I have checked that the directory is correct AND that the file exists. I have no clue how to show the image, every I run it the output is either nothing or "/htdocs/page/members/username_tracks/images/imagefile.jpg". $imagedirectory = $_SESSION["rename"]; while (($out = mysql_fetch_array($rs2, MYSQLI_ASSOC))&&($i<=7)) { $trackname = $out['track']; $original_artist = $out['original artist']; $genre = $out['genre']; $style1 = $out['style1']; $style2 = $out['style2']; $style3 = $out['style3']; $type = $out['type']; $date = $out['date']; $downloads = $out['downloads']; echo (" <table width='600' border='0' class='tables'> <font color='#0066ff' size=1> <tr> <td width='50' rowspan='3'> [color=red]<img src=\"$imagedirectory\"/> [/color]</td> <td width='200'><font color='#ffffff' size=1> $trackname </td> <td width='115'><font color='#ffffff' size=1> $genre </td> <td width='90'> <font color='#0066ff' size=1>$style1 </td> <td width='115'> </td> <td width='20' rowspan='3'><img src='PNG_IMAGES/sample.png' /></td> </tr> <tr> <td width='200'> <font color='#705698' size=1> $DJname </td> <td width='115'> <font color='#705698' size=1> $array[0] </td> <td width='90'> <font color='#0066ff' size=1>$style2 </td> <td width='115'> <font color='#705698' size=1> $downloads </td> </tr> <tr> <td width='200'> $original_artist </td> <td width='115'> $size2 MB </td> <td width='90'> <font color='#0066ff' size=1>$style3 </td> <td width='115'><a href='www.break.com'>DOWNLOAD</a> </td> </tr><span class='style30'> <br> </table> "); $i++; } EDITED BY akitchin: code tags are there for a reason. please use them. Quote Link to comment https://forums.phpfreaks.com/topic/66057-displaying-an-image-from-directory/ Share on other sites More sharing options...
Fadion Posted August 22, 2007 Share Posted August 22, 2007 As the script looks ok to me, i can only assume u have not used session_start() before using the session variable, as this is also a very common error. Thats probably ure getting not output for the image. Quote Link to comment https://forums.phpfreaks.com/topic/66057-displaying-an-image-from-directory/#findComment-330479 Share on other sites More sharing options...
Fuzzy Wobble Posted August 22, 2007 Author Share Posted August 22, 2007 session is initiated. problem still occurs Quote Link to comment https://forums.phpfreaks.com/topic/66057-displaying-an-image-from-directory/#findComment-330534 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.