Tuesday, March 28, 2006

Collaboratively Adoppt your Photos!

First, thank you so much to everyone who commented (and e-mailed) me about my previous blog post. I wasn't really preaching to use auto increment to anyone, just wanted to experiment. The bottom line is to not use auto-increment, rather use sequences or work around the application logic.

Now, to get to the point. I am very excited since with about eight hours of work, I added the entire photo gallery feature to Adoppt. I'm still working to find out the bugs, but it's pretty neat.

For starters, it takes your photo and creates different sizes out of it. You can upload a photo upto 600K and it will web-optimize the photo for you. In addition the small and medium sized images have rounded edges. And you know what's cool? You can tag the photos just like anything else for your organization. In addition now you can create collaborative galleries with friends. So all my friends can create a collaborative MySQL gallery where we can all share all the photos together.


Once the photo has been uploaded, the photo owner can access different kinds of codes, such as bbcode to use the photo in the forum post, HTML code to post the photo anywhere etc. This allows you to "hot link" your Adoppt photos from anywhere.


All the photos are being stored as files rather than in MySQL. The photo attributes obviously go in MySQL. I took quite a bit of tips from Sheeri's recent discussion about When to put images in MySQL.

In case you are wondering how I was able to create the collaborative photo gallery, you will want to read my upcoming Pro Rails book in which I go in great detail about the steps I took to create this feature.

Finally, I am moving the Adoppt blog to well, Adoppt. From now on all the latest news will be posted to http://blogs.adoppt.com/blog/mradoppt.

2 comments:

Sheeri said...

Glad the discussion helped....what kind of a storage/hashing algorithm are you using? I have a photo site where I manually store photos in albums, so it scales because there aren't more than a few hundred photos in any given directory, and the directories are laid out as such:

top level/year/eventname

So there aren't many sub-directories in each directory (maybe a dozen or 2 events in each year).

Frankly Speaking! said...

Sheeri, thanks for your comment.

After quite a bit of thinking, I am storing the photos as follows:

photos/member_id/photo_size/picture_id

Photo size can be large, small or medium.

I like your idea of storing them by even type. My main thought was to be able to access all member photos easily using the directory.

Frank