PHP/MySQLi - how do I add ability to display images with records?
-
I'm still fairly new to PHP/MySQLi. Trying to get a grasp on some basics. Currently, I have: db_gallery, tb_gallery, columns: item_id, title, artist. I display the item list in table format on the web page using printf. I'd like to be able to display an image (or two) with each record. What is the best way to do this? I think that images can be stored in the database itself (something about BLOB), or maybe I should just store the filename of the image, and put the images in a folder? Eventually, the page will go live online, but for now I'm working on my home computer using apache on Windows. So my question(s): > What is the best way to set up the images in the database and/or folders. (Hundreds of images). > How do I then display the image with each record on the web page
-
Answer:
I would opt for the second option. Store the files on your hard disk, and just reference them in the database. Storing them as a blob is a bit messy and will make your table huge and have a nasty impact on it's query performance. To display the image on your webpage, you will need to use an img tag and set the src in the tag to point to the image file. Check out the w3schools example if that doesnt make any sense: http://www.w3schools.com/tags/tag_IMG.asp :-)
Sarah M at Yahoo! Answers Visit the source
Related Q & A:
- How can we add our own display photo in Yahoo?Best solution by Yahoo! Answers
- I want to add my personal photos. how can i add it.
- How do I change my YouTube display picture?Best solution by Yahoo! Answers
- How do I change my facebook display name?Best solution by Yahoo! Answers
- How can I get contacts to display?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.