picture-1Non-geeky friends: if you value our friendship, please stop reading now!

apple_iphoneAfter learning that the iPhone 3G embeds GPS location data in the ‘meta-data’ of every photo, I thought it would be cool to use this information to show the location of photos I post on my Wordpress (self-hosted) blog. An example is shown on left.

Once you have things set up, you simply need to take a photo, email it to a certain ’secret’ email address, placing the post title in the subject and post content in the body of the email, and voila – everything else is automatic!

To do this you will need the following:

  1. iPhone 3G (or other device with GPS, camera and email)
  2. Wordpress blog & host that allows you to install plugins
  3. A host that allows you to set up something called a ‘cron job’ – basically a server setting that runs a predefined script every x minutes/hours/days. I use Godaddy and they allow it.
  4. The ExZO plugin (I’m using version 0.b7.5)
  5. The Postie plugin, development version

Step 1:

Set up an email address for your mobile blog posting. You will need POP3 access to the mail account, so make sure you record the POP server details and the login/password for the new email account.  Mine is “somethingsecret@ryanvanlaar.com”.

Step 2:

Set up the two plugins according to their creators instructions (basically just copy to your plugin directory and activate as per usual). Then you will need to modify their settings as follows

ExZo:

In the custom exit template box, enter the following code:

<iframe width=”425″ height=”150″ frameborder=”1″ scrolling=”no” marginheight=”0″ marginwidth=”0″ src=”http://maps.google.com/maps?q=%GPS_LATITUDE_DE%,-%GPS_LONGITUDE_DE%&amp;ie=UTF8&amp;ll=%GPS_LATITUDE_DE%,-%GPS_LONGITUDE_DE%&amp;spn=0.019506,0.072956&amp;z=13&amp;output=embed”></iframe><br /><small><a href=”http://maps.google.com/maps?q=40.749333333333,-74.006&amp;ie=UTF8&amp;ll=%GPS_LATITUDE_DE%,-%GPS_LONGITUDE_DE%&amp;spn=0.019506,0.072956&amp;z=13&amp;source=embed” style=”color:#0000FF;text-align:left”>View Larger Map</a></small>

Also set the exif option to “on if available”.

Postie:

In the Postie options, there is a space for a custom image template. Below is the template I use, of course you can modify as required for your particular setup:

<a href=’{IMAGE}’><img src=”{THUMBNAIL}” alt=”{CAPTION}” title=”{CAPTION}” class=”attachment” /></a><div class=’imagecaption’>[exif="{RELFILENAME}"]</div>

Also, make sure you set the custom image template to ‘on’ in the drop-down menu above the template field.

Next, make sure you configure your mail server settings correctly for the new email address you created in step 1.

Specify other options, categories, formatting etc as required. In general though, keep it simple until you get everything working.

Click on the ‘test postie’ button to make sure Wordpress can communicate with the email server.

Step 3:

picture-2

Set up a ‘cron job’ on your web host. I use godaddy and eventually discovered where to do this:

Hosting Control Centre -> Content -> Cron Manager

This step might vary according to your host and wordpress setup, however this is a snapshot of my configuration – in case it is useful to anyone.

Step 4:

photoYou should now be good to go!

Test out the whole setup by taking a photo with your iPhone (allow the camera to “use your location”), attach the image to an email and enter a post title/body text shown here and hit send.

If you want wait for the cron job to run, import your email and regurgitate to your blog, just go back into the Postie options and hit the ‘run postie’ button at the top. The result is kind of a weird text output, but just hit the back button after the page has finished loading and then check the results.

Feel free to leave a comment below if you tried all this and it doesn’t work.