How to: Geotagged photobloging with iPhone 3G & Wordpress
Non-geeky friends: if you value our friendship, please stop reading now!
After 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:
- iPhone 3G (or other device with GPS, camera and email)
- Wordpress blog & host that allows you to install plugins
- 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.
- The ExZO plugin (I’m using version 0.b7.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%&ie=UTF8&ll=%GPS_LATITUDE_DE%,-%GPS_LONGITUDE_DE%&spn=0.019506,0.072956&z=13&output=embed”></iframe><br /><small><a href=”http://maps.google.com/maps?q=40.749333333333,-74.006&ie=UTF8&ll=%GPS_LATITUDE_DE%,-%GPS_LONGITUDE_DE%&spn=0.019506,0.072956&z=13&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:
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:
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.
















about 11 months ago
Are u for real? Looks like I will need extra time in NYC for lessons….haha
about 6 months ago
One day you’re going to take a photo and without realizing it, the map will place you in some seedy brothel. I know it. I can read the future.