Sarahc Posted December 15, 2006 Share Posted December 15, 2006 I have a database with a php script that creates thumbnails that are named for the ID(id.jpg or id.gif) and stored in a folder on the server. How do I call this image to be shown along with the records. Here is the script that shows the other catagories:[code]<?php$rowcolor = 1;$sql = "select recipeid, title, date, rating from recipes where status = 'L' order by rating desc limit 0,10";$result = mysql_query($sql ,$db);if ($myrow = mysql_fetch_array($result)) {do {if ($rowcolor == 1) {$rowcolorhex = "#ffffff";$rowcolor = 0;} else {$rowcolorhex = "#CC6600";$rowcolor = 1;}printf("<tr>");$rowcolorhex, $myrow["recipeid"], $myrow["title"]);printf("<td width=80 bgcolor=%s align=center><FONT face=arial size=2>%s</font></td>", $rowcolorhex, $myrow["date"]);printf("<td width=75 bgcolor=%s><table bgcolor=%s border=0 cellspacing=0 cellpadding=0><tr>", $rowcolorhex, $rowcolorhex);$onstars = round($myrow["rating"]);$offstars = 5 - $onstars;for ($i = 1; $i <= $onstars; $i++) {printf("<td width=15 bgcolor=%s align=center valign=center><FONT face=arial size=2><img src=images/staron2.gif></font></td>", $rowcolorhex);}for ($f = 1; $f <= $offstars; $f++) {printf("<td width=15 bgcolor=%s align=center valign=center><FONT face=arial size=2><img src=images/staroff2.gif></font></td>", $rowcolorhex);}printf("</tr></table></td>");printf("</tr>");} while ($myrow = mysql_fetch_array($result));}?></table></TD></TR><tr><td width=480 colspan="2" align=center> <table cellpadding=1 cellspacing=1 border=0><tr><td bgcolor=#000000 width=480 height=20 valign=center align=center> <table cellpadding=0 cellspacing=0 border=0><tr><td bgcolor="#CC6600" width=478 height=18 valign=center align=left> <font face="Arial, Helvetica, sans-serif" color="#000000" size="3"><b>Search</b></font> </td></tr></table></td></tr></table></td></tr><TR> <TD colspan="2" valign=top> <br><center><font size=2 face='Arial, Helvetica, sans-serif'><b>Search the entire database of recipe's</b></font> <br><form action=results.php method=post><input type=text name=searchingred size=40> <input type=submit value=Search></form>[/code] Link to comment https://forums.phpfreaks.com/topic/30715-please-help-display-a-thumbnail/ Share on other sites More sharing options...
drifter Posted December 15, 2006 Share Posted December 15, 2006 if(file_exists('/path/to/images/' . $myrow["recipeid"] . 'gif')){ $image='/path/to/images/' . $myrow["recipeid"] . 'gif';}else if(file_exists('/path/to/images/' . $myrow["recipeid"] . 'jpg')){ $image='/path/to/images/' . $myrow["recipeid"] . 'jpg';}echo "<img src='" . $image . "'>"; Link to comment https://forums.phpfreaks.com/topic/30715-please-help-display-a-thumbnail/#findComment-141558 Share on other sites More sharing options...
Sarahc Posted December 15, 2006 Author Share Posted December 15, 2006 Can you show me where it goes in the script? I want the image right before the title and I can't seem to get it to work Link to comment https://forums.phpfreaks.com/topic/30715-please-help-display-a-thumbnail/#findComment-141565 Share on other sites More sharing options...
Sarahc Posted December 15, 2006 Author Share Posted December 15, 2006 I got it. Thank you!!!! ;D Link to comment https://forums.phpfreaks.com/topic/30715-please-help-display-a-thumbnail/#findComment-141804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.