I'd like to create a database of pictures. Where to begin? [closed]
Sebastian Wright
I'd like to create a searchable database of images.
I'd like something a little expandable, meaning I'd like to define my own fields and be able to search on them, but I'd also like to be able to insert keywords for broader searches.
I am a little concerned about encountering too steep a learning curve, but am willing to put in some work. :-)
A few more items that may help: Although I am open to hosting such a thing online, it's probably not my first choice. Also: I think we talking about a few dozen images initially but more over time.
23 Answers
My first thought is that you don't... place pictures in a directory and you can store links to the files, tags, etc in the database.
2If you were using Windows you could use picasa from picasa.google.com. Pictures can be tagged with whatever you want and you can search based on those tags.
Option 2:
galleryproject.org
It is web based and has a mysql database, but the gui is simple. You can tag pictures and search on those tags. There are addons/extension for additional functionality.
Option 3:
A wiki such as mediawiki might also work.
5Since you don't mention where do you want to implement your database, I assume you're doing this for a website, the approach I've been using is as follows:
Let's say that I have a directory with 100 pictures, each one named in order:
1.png
2.png
3.png
…
100.pngSo I construct a database which stores such images information in the colums as follows:
id, name, size, keywords, …So I'd construct a query that retrieves them based on the pertinent information provided:
"SELECT * FROM `images` WHERE NAME LIKE ?"And so I can access them since their id's correspond to their filenames, e.g.:
echo '<img src="'.$queryResult->id.'png">';But again, it depends on your implementation, is this for a website, a mobile app or a desktop app?
Update:
Since you say this is for a website, and if the images are not going to be uploaded by the clients, but only by the admin, then this is most certainly the best approach. But you may want to take a look at BLOBs too.
The main advantage of this approach (storing them on the filesystem rather than inside a db) is that you can easily access your images and edit them, resize them, change them and do whatever you can do to a normal image, without having to retrieve them from the db everytime you have to do a change. In fact, many websites that host users' OC use this approach of storing the images, e.g: 9GAG, 4Chan.
4