angel55 Posted May 26, 2009 Share Posted May 26, 2009 I have problem with viewing my image.When i load the image page it give me loads of symbols.I can not get my photo field to be displayed, it gives all different sysmbol. $db1 = new estate(); $db1->openDB(); $sql="SELECT * from properties"; $result=$db1->getResult($sql); echo "<table border='1' >"; echo "<tr><th>Properties_ID</th><th>Type</th><th>Price</th><th>Address </th><th>Postcode</th><th>Photo</th></tr>"; while($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td>{$row['Properties_ID ']}</td><td>{$row['Type ']}</td>"; echo"<td>{$row['Price']}</td><td>{$row['Address']}</td>"; echo "<td>{$row['Postcode']}</td><td>{$row['Photo']}</td>"; echo "</tr>"; Link to comment https://forums.phpfreaks.com/topic/159760-image/ Share on other sites More sharing options...
redarrow Posted May 26, 2009 Share Posted May 26, 2009 <?php echo"<img src='{$row['photo']}' />"; xhtml way. <?php echo"<img src='{$row['photo']}' >"; html way. i hope the $row['photo'] from the database,points to the correct folder and file from the while loop. in other words have you enter the path to the current files or is photo the file names? <?php echo"<img src='{$row['photo']}' >" << no directory? [code]<?php echo"<img src='pic/{$row['photo']}' >" << with directory Link to comment https://forums.phpfreaks.com/topic/159760-image/#findComment-842611 Share on other sites More sharing options...
angel55 Posted May 26, 2009 Author Share Posted May 26, 2009 thnx. It still doesnt work, now it gives a red cross in image box .I have stored my image in the database. Link to comment https://forums.phpfreaks.com/topic/159760-image/#findComment-842645 Share on other sites More sharing options...
redarrow Posted May 26, 2009 Share Posted May 26, 2009 what as binary $query = "select image from se_keys where id = $id"; $result = mysql_query($query); $row = mysql_fetch_array($result); echo"$row[image]"; then $query1 = "select * from se_keys"; $result1 = mysql_query($query); $row1 = mysql_fetch_array($result1); <img src='imget.php?id=$row[id]'> sorry very busy. Link to comment https://forums.phpfreaks.com/topic/159760-image/#findComment-842649 Share on other sites More sharing options...
angel55 Posted May 26, 2009 Author Share Posted May 26, 2009 this is my table.i did photo as blob. CREATE TABLE IF NOT EXISTS `properties` ( `Properties_ID` int(4) NOT NULL AUTO_INCREMENT, `Type` varchar(20) NOT NULL, `Price` float NOT NULL, `Address` varchar(40) NOT NULL, `Postcode` varchar(7) NOT NULL, `Photo` blob NOT NULL, `IsAvailable` varchar(4) NOT NULL, `Agent_ID` int(4) NOT NULL, PRIMARY KEY (`Properties_ID`), UNIQUE KEY `Agent_ID` (`Agent_ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; There is no picture displaying just red cross. Link to comment https://forums.phpfreaks.com/topic/159760-image/#findComment-842652 Share on other sites More sharing options...
Axeia Posted May 26, 2009 Share Posted May 26, 2009 afaik you'll need a second page which will function as the image and does something like <?php header('Content-Type: image/jpeg'); //DB stuff here echo $row['Photo']; ?> Of course you could make that second page work off an $_GET['value'] and then use <img src='/secondPageScript.php?imageId' alt='' /> Or you could just not store the image in the database but save the path to it, which is a lot more resource friendly and you'll be less likely to get a mail from your host stating that you need to lower the resource use of your page by the end of the month or switch to a more expensive package. Link to comment https://forums.phpfreaks.com/topic/159760-image/#findComment-842653 Share on other sites More sharing options...
angel55 Posted May 26, 2009 Author Share Posted May 26, 2009 thnx, i will try tat Link to comment https://forums.phpfreaks.com/topic/159760-image/#findComment-842692 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.