desjardins2010 Posted December 15, 2013 Share Posted December 15, 2013 can some help me with a small problem... I have a site that I want to create an admin section for that will allow the user to update a certain page with it's contents- thus far i'm ok cause more is just text and link however there is an image for each entry that I'm unsure how to store... I've been told it's unfair practice to store images in a DB and if that's true then storing them inside folders isn't a problem if that's how it's done - but if that is the case would I just include an upload script to put the image on the server and reference the image In the DB? and in that's the case what foundation would I use while building the DB structure would I use to store links to such images? Quote Link to comment https://forums.phpfreaks.com/topic/284771-really-curious-how-to-store-or-retrive-images/ Share on other sites More sharing options...
Ch0cu3r Posted December 15, 2013 Share Posted December 15, 2013 (edited) When the image is uploaded you save the images path to the database. When you want to display the image you echo the images path into the <img> tag eg echo '<img src="' . $row['image_path']; '" />'; Edited December 15, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/284771-really-curious-how-to-store-or-retrive-images/#findComment-1462369 Share on other sites More sharing options...
cyberRobot Posted December 16, 2013 Share Posted December 16, 2013 Minor correction...this echo '<img src="' . $row['image_path']; '" />'; Should be echo '<img src="' . $row['image_path'] . '" />'; Quote Link to comment https://forums.phpfreaks.com/topic/284771-really-curious-how-to-store-or-retrive-images/#findComment-1462445 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.