Holy cow that was hard. But I finally have my picture uploading scripts working. Parsing mutipart mime emails is not exactly my idea of fun. But now I can mail right from my phone to a special email address that then automatically posts the images to my new photolog.

No doubt you'll want to keep track of the nonstop excitement over there by adding it to your homepage. For guests I still have to enable email notification (as well as weblogs.com pings) for these auto posts.
- jim 11-30-2003 12:16 am

Oh yeah, it auto scales the images too. But the whole thing is hard coded to work with my particular system, so I still have to go back and do a few rounds of abstracting so that this will be generally useful (like for someone besides me.) That will take some time, but it shouldn't be as hard as what I did today.

And then I have to restructure the image library. Right now they are all kept in one directory. And I think this will be a problem as the total number grows. There are around 3700 files in that directory now. When does this become trouble? I'm not sure but I think it will be sooner rather than later. So I will make subdirectories for each user inside that folder and then move individual pictures into their subdirectories.

Yes, I will be writing a script to do this. And yes, I will back it up first. What could go wrong?
- jim 11-30-2003 12:27 am


I was wondering about that. Right now I have a "complete list" of my image files, and folders containing groups from the complete list. The complete list is getting long, and I don't even want to think what will happen if you push "view as thumbnails" (OK probably just a huge browser page that takes a long time to load.) I was figuring at some point you'd do away with "complete list" and just go with the folders. Is that what's happening? (Actually, come to think of it, some of my older files may not be in folders--do we need to create folders for them?)

Looking forward to checking in regularly on your photolog.
- tom moody 11-30-2003 12:54 am


Yeah, it's kind of confusing. I'm having a hard time explaining it.

When you upload a photo the system stores meta information about that photo in the database: a unique identifier, actual file name, your name, time uploaded, bytes, file type, as well as the location of the photo on the server. But then the photo itself is thrown into one single directory (everybody's photos all together.)

So when you load the /image page and see that you have photos in several folders, this doesn't actually correspond to the linux filesystem the server is running on. These folders are just an abstraction I have made on top of that. They don't really exist.

It's good to make such abstractions because now when I move the actual files around (into subdirectories) you won't notice anything. I'll just move each file, and then update the database by changing the location of the file information.

So when you request /getpic/xxxx/ the system looks up xxxx in the database, finds out where the file is actually stored in the linux filesystem, and then goes and gets it. So as long as I change that database information when I move the file nothing will break. I could even put the images on another server, and /getpic/xxxx/ would still retrieve the same picture as before.

- jim 11-30-2003 2:05 am


OK, I was confusing "breaking up the big list (everybody's pics) into subdirectories" with breaking up people's individual "complete lists."
- tom moody 11-30-2003 2:46 am





add a comment to this page:

Your post will be captioned "posted by anonymous,"
or you may enter a guest username below:


Line breaks work. HTML tags will be stripped.