views:

765

answers:

2

Hi all,

I am constantly taking the following steps, and I know there's a way to automate this:

  1. emailing photos from my phone to myself
  2. saving those photos to my computer
  3. uploading the saved photos to a website

Is there a way to write a script (perhaps in PHP), that does the following:

  1. listens to any emails sent with attachments to a bot email (ex: [email protected])
  2. automatically uploads any attachments sent to that email to the site? (ex: upload to www.site.com/photos)
A: 

If your phone can go online, why email them and not directly upload photos to your site? Many mobile platforms have clients for adding entries and images to blogs and hosting services like Flickr. Maybe there is such a client right for your phone?


Script on its own is a passive thing. I'm not familiar with PHP though but... If you have a page open 24h/day, you could put there JavaScript calling some server method in loop once in 10 minutes to check for emails and if there are attachments just initiate asynchronous form post.

Would be great if you could elaborate and whatever you have at your disposal. Is it your site and you have administrative access or you just a user? Is there maybe an API to use in addition to just HTTP POST?

I believe, unless it's your own site, you will need somewhere a PC running all the time with either a browser window or a desktop program open.

User
it's for my own personal site, and i am just tired of repeatedly doing the email/save/upload thing. Flickr sounds like the easiest approach but i do want to host this on my site.i have an iPhone, and an iPhone dev license, so perhaps the easiest thing is just to write my own little app here to access the site itself. open my app, take a photo, and i'm done.
livetotry
+2  A: 

If you must have it on your server, there are a couple approaches.

  • PHP can check a mail account via POP3 or IMAP. You could have a cron job running that fires off a PHP script to check a secret e-mail account every few minutes and process there.
  • Incoming e-mail can also be piped directly to a PHP script

I just use Flickr, and they give you a random e-mail address @flickr.com that you can send attachments to and have them automatically processed. That's the fastest and easiest option if you're okay with Flickr hosting your photos.

ceejayoz
thanks ceejayoz, this is really helpful
livetotry