Jump to content

Recommended Posts

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'>&nbsp<br>
</table>

  ");
  $i++;
}

 

EDITED BY akitchin:  code tags are there for a reason.  please use them.

Link to comment
https://forums.phpfreaks.com/topic/66057-displaying-an-image-from-directory/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.