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.. Link to comment https://forums.phpfreaks.com/topic/124171-how-to-retrieve-the-image-from-mysql/ 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. Link to comment https://forums.phpfreaks.com/topic/124171-how-to-retrieve-the-image-from-mysql/#findComment-641086 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 Link to comment https://forums.phpfreaks.com/topic/124171-how-to-retrieve-the-image-from-mysql/#findComment-641093 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? Link to comment https://forums.phpfreaks.com/topic/124171-how-to-retrieve-the-image-from-mysql/#findComment-641094 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. Link to comment https://forums.phpfreaks.com/topic/124171-how-to-retrieve-the-image-from-mysql/#findComment-641097 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.. Link to comment https://forums.phpfreaks.com/topic/124171-how-to-retrieve-the-image-from-mysql/#findComment-641099 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. Link to comment https://forums.phpfreaks.com/topic/124171-how-to-retrieve-the-image-from-mysql/#findComment-641105 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! Link to comment https://forums.phpfreaks.com/topic/124171-how-to-retrieve-the-image-from-mysql/#findComment-641109 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 Link to comment https://forums.phpfreaks.com/topic/124171-how-to-retrieve-the-image-from-mysql/#findComment-641111 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? Link to comment https://forums.phpfreaks.com/topic/124171-how-to-retrieve-the-image-from-mysql/#findComment-641121 Share on other sites More sharing options...
sabo86 Posted September 14, 2008 Author Share Posted September 14, 2008 any help plz? Link to comment https://forums.phpfreaks.com/topic/124171-how-to-retrieve-the-image-from-mysql/#findComment-641454 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.