Image Handling

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Theory?
Forum Contributor
Posts: 138
Joined: Wed Apr 11, 2007 10:43 am

Image Handling

Post by Theory? »

So I was reading this tutorial on Spoono about storing images in a database using Base64 encryption, but I was just wondering a few things. Does anyone know if this is an effective means of doing image persistence? I'm trying to build an image gallery for my girlfriend's website, she does photography and needs a portfolio site. They say on the site that it's good for using on avatars in forums, but I'm wondering if this is an effective means to persist large images that need to be accessed in bulk. It seems like this method would be cumbersome for this application and also slow. I had planned to simply store the locations of uploaded images into the DB and recall them that way, but if this is truly a more effective means to do this then I will.

Or maybe there's a better way?
Last edited by Theory? on Thu Oct 30, 2008 9:41 am, edited 1 time in total.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Storing Images in a Database

Post by onion2k »

Store the location of the file and put the image in the filesystem as you'd planned originally. It's a lot quicker and easier to do that than accessing them from a database.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Storing Images in a Database

Post by josh »

The reason its good for avatars on forums is you can limit avatars to something like 32 kb or 64kb, even then I'd put them in a separate table than the user table itself used for normal user operations. Then you could avoid file system image storage with reasonable performance hits. For a photography site I'd definitely use the filesystem and only store the photos meta data in the database
Theory?
Forum Contributor
Posts: 138
Joined: Wed Apr 11, 2007 10:43 am

Re: Image Handling

Post by Theory? »

Thank you both. That was really helpful.

Now, here comes part two. I was wondering what the benefits, if any, would be to designing the gallery using XML instead of an RDBMS, or hell, maybe in conjunction with one. I figured using an XML doc to store the image location and all the EXIF metadata would give me greater flexibility for displaying the information, especially when it comes time to reuse this system in a different project. I did some research and so far I've found that most people who take this approach end up using Flash to display the images, which makes sense, but this project doesn't call for Flash, so maybe I could do a neat little Ajax type presentation.

Anyone have any experience designing a photo gallery like this?
Post Reply