by Flemming Funch
Alright, so having a mobile phone with a camera I of course need to have a moblog. "Moblog" is an even worse word than "Blog", but that's somehow what it got to be called. It is essentially that you can make a posting on your blog while on the go, from a phone or PDA. Typically it is done by having the latest picture in a sidebar, which then links to the gallery of past pictures. So it becomes sort of a different track, with smaller snapshots of things one is doing, without having to be able to say something clever about it.
I had in mind programming it myself, so that it could be integrated with my NewsLog blogging program. So, the first thing needed was a gallery. And there's of course no reason one should only be able to post to it with a phone, so I made it so one can upload from a normal file too, or grab a picture from a URL. And so one can edit the titles, delete mistaken pictures and stuff like that.
OK, then the aspect of how we get from my phone to a file on the server, if I go that way. I could make my own approach, but I glanced at other people's suggestions to see what might be the best practices. Like this how-to guide by David Davies.
So, I set up a separate e-mail account for the purpose. No problem to send a picture from the phone to an e-mail address. Then I'll put a password in the subject line, which will ensure that no random spam gets posted. And I'll put some descriptive text in the message itself.
Now, picking up e-mail from a pop account, and finding an attached picture, is not quite as trivial a programming task as it might look like. It is no wonder that most e-mail programs do something different and often screw up each other's messages. The standards are rather complicated, and everybody doesn't keep them. So this part took the longest time. I used PHP's built-in IMAP functions, which is based on a common IMAP library. Which exposes a lot of the dirty detail, rather than just doing the job for me, like handing me the attachment no matter where it was hiding. For starters, I made it so that it at least picks up the text and attachments the way my phone sends it. Which happened to be two different ways depending on whether it was a photo or a drawing. Next I'll try sending pictures from my normal e-mail programs and debug what goes wrong with that. Anyway, I made the program pick up mail once per hour, as the mail pickup is rather slow, and I don't want to overload anything if there ends up being many of these accounts.
You can see the current result in my right sidebar. Just a few pictures so far, but you get the point.
And for you other guys who use my NewsLog program, I need to work out a few more details, then this functionality will be available for you too. I.e. you can have a picture gallery, and optionally post to it via e-mail. Only hurdle for that part might be to acquire an extra e-mail account for the purpose.
|
|