sabo86 Posted September 14, 2008 Share Posted September 14, 2008 I have this code now (I've been editing it thousands times ) for ($i=0; $i <$num_results; $i++){ $row = mysql_fetch_array($result); echo " <p><strong>".($i+1).".Model: </strong>"; echo htmlspecialchars(stripslashes($row["Model"])); echo "<br><strong> Description: </strong>" ; echo htmlspecialchars (stripslashes($row["Description"])); echo "<br><strong> Category: </strong>"; echo htmlspecialchars (stripslashes($row["Category"])); echo "<br><strong> Image: </strong>"; echo $row["Picture"];} How can I retrieve the image and display it in the correct place? I've heard that storing them in blob format will exhaust mysql.. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 14, 2008 Share Posted September 14, 2008 What is held in the variable $row["Picture"] Is it a path to an image or is it the binary code of the image itself? If is the first then just output an HTML image tag to display the image, eg: echo "<br><strong> Image: </strong>"; echo '<img src="'.$row["Picture"].'" />';} However for the latter its a bit more complex as you cannot display binary data within a HTML page. Quote Link to comment Share on other sites More sharing options...
sabo86 Posted September 14, 2008 Author Share Posted September 14, 2008 thanks wildteen88 for your help.. it really works!! I appreciate Quote Link to comment Share on other sites More sharing options...
sabo86 Posted September 14, 2008 Author Share Posted September 14, 2008 btw, is there anyway that makes this image a thumbnail in a way i can click it to get the actual size? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 14, 2008 Share Posted September 14, 2008 Yes, you'll need to have two images for this to work. The actual image itself and a smaller version of the original image for the thumbnail. You'll then do something like this: echo "<br><strong> Image: </strong>"; echo '<a href="'.$row["Picture"].'"><img src="'.$row["PictureThumbnail"].'" /></a>';} The code will not work until you have field in your database called PictureThumbnail -- this will hold the path to the thumbnail for the image. Quote Link to comment Share on other sites More sharing options...
sabo86 Posted September 14, 2008 Author Share Posted September 14, 2008 isn't there is another way of resizing the same picture.. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 14, 2008 Share Posted September 14, 2008 There is an automated process you could use which requires gd. There are many tutorials on the net for creating thumbnails with gd. Quote Link to comment Share on other sites More sharing options...
sabo86 Posted September 14, 2008 Author Share Posted September 14, 2008 I know graphic design, but haven't heard about an automated way as a programming way! Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted September 14, 2008 Share Posted September 14, 2008 http://www.google.com/search?client=safari&rls=en-us&q=php+create+thumbnails&ie=UTF-8&oe=UTF-8 Quote Link to comment Share on other sites More sharing options...
sabo86 Posted September 14, 2008 Author Share Posted September 14, 2008 one more question before i try the automated thing.. I created an attribute for the thumbnail... and Now i have the following result .. and i want to make it in this way: http://img382.imageshack.us/my.php?image=res2kn9.jpg How can I edit my code? Quote Link to comment Share on other sites More sharing options...
sabo86 Posted September 14, 2008 Author Share Posted September 14, 2008 any help plz? Quote Link to comment 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.