Sunday, November 05, 2006

Picture of the moment

My Picture of the Moment

Jo's Picture of the Moment

I will add soonI will add soon

After finally giving in to my friend to start a Myspace account I started thinking of neat things I could do with the HTML that would justify my having one (aside from being a complete dork). The first thing I thought that would be really cool was to be able to send photos to it on the fly from my cell phone from where ever I was. Free upload sites have random URLs and I can't sent a photo directly from my phone.
I think there are phones now that will do this for you, but I am still in love with my Motorola E815 and wanted to find a way to use it to get the detailed events of my boring life posted as soon as humanly possible not to mention I love mental exercises!. After a few days of thinking, and a lot of coffee and cigarettes I came up with the following solution which works surprisingly well provided I have no programming skills whatsoever. My moto is with enough coffee, cigarettes and curiosity you can make anything work

What you'll need

webserver I use apache
If you don't already have a webserver I found a great tutorial on lifehacker that shows you how to set it up step by step. You can find the instructions here
I am using an old PIII PC running Windows XP Pro overclocked a bit and sorely low on memory
Eudora (Sponser version works fine) and an email that supports pop forwarding, I use Gmail
An MMS enabled camera phone with the ability to change the photo's name
A Myspace or somewhere to post your photos to, I've even embed the HTML on my pc using active desktop so I can see the current pictures of my friends

Step one, get the pic off the phone and into the pc

One of the cool features of Eudora is how it handles attachments. When an email with an attachment is received by Eudora the attachment is detached and stored in any folder you want. Since my phone does not support any kind of FTP program but can send SMS and MMS, I thought this would be a perfect solution to getting info off of my phone and onto my pc

Install Eudora and specify which folder you want your attachments to be dumped to, the path can be set under options/attachments. I have my folder set to "photos", be sure this folder falls under the main directory in Apache or whatever webserver you're using. Next you'll need an email address to email the photos to. I use a Gmail account since it supports POP forwarding and has plenty of storage which acts as a back up of all of my photos. See the Gmail documentation for setting it up with Eudora.

By renaming the photo with a predetermined name before emailing it will make it easier to know what the url will be. I personally use a.jpg for all of my Picture of the Moment photos. But wait! when I send two files with the same name one is renamed!
The next major hurdle was what to do if I wanted to update the photo on the fly. If I sent another a.jpg to the server the file name would be changed since you obviously can
not have two of the same file names in the same directory. So to fix this little snag I wrote a simple batch script

copy/y "D:\my music\photos\a.jpg" "D:\my music\photos\newpix"

del/q "D:\my music\photos\a.jpg"

As I mentioned I have no programming skills at all, not even simple batch scripting so i am sure there is a better way to write this little file.
copy the above lines (subbing all of my file paths for your own) paste it into notepad and name it with a .bat exension and save it somewhere you can find it . Next we'll set up a rule in Eudora to run this batch script any time you send a photo. This rule can be when any email from your phone is recieved (by adding the email address of your phone to the "from" line) or if you want to put a specific word in the subject line it can watch for it also
What this does is take the file from the original folder "photos" and dumps it into a new folder "newpix" while overwriting any existing files named a.jpg. and deletes the original a.jpg from the photos folder. Now we'll know exactly where our new photo is located, in my case photos\newpix\a.jpg . You can use this url to encode your myspace or blog or anything else really

So here is how it works

I see a goofy dog with a sweater running across the the street and I snap a photo of it. I rename the photo "a" on my phone and email it to my Gmail account, Eudora
picks it up (i have it checking every minute, I told you I want this stuff up ASAP) and it detaches the attachment to my "photos" file, Eudora sees that the email came from my phone and runs the batch script to take the picture from "photos", it copies the pic to "newpix" while overwriting the prior picture and then deletes all pictures named a.jpg from the "photos" file. It now exists on my webserver. Now anyone viewing my myspace, yes all 6 of my friends including Tom, will see that goofy little dog too.

Photos that you do not necessarily want to exist as your "picture of the moment" can be sent with the existing files names and since the script will not recognize it unless it's named a.jpg will still exist in the original folder

it's easy to add a friends to your set up, by changing the bat file a little, and adding a new rule your friend can send photos named for instance b.jpg and it will work fine, I currently have two friends using my set up.

The picture of the moment is not limited to pictures either, my Moto will take about 15 seconds of video in 3g2 format which can be viewed via Quicktime, with a little tweaking to the html on your myspace (or wherever you intend to post) you can add video too. I personally like the idea of embedding text which can be done by sending a text attachment, however myspace will not accept an object tag so it can not be used there.
Also, I should mentioned this is tried and true with a verizon phone. I've also used Metro PCS and found that the photos is embeded. If you intend to try this with Metro you'll find your photo's in C:\Documents and Settings\yournamehere\Application Data\Qualcomm\Eudora\Embedded\. You'll need to edit the batch script accordingly


Post a Comment

<< Home