Hack 18. Blog from Your Mobile Phone

Use a mobile blogging service to post blog entries with pictures from your mobile phone.

Not long ago, bloggers could only update their blogs using a computer. Inspiration, however, does not always coincide with the presence of a bulky computer. At the turn of the century, some adventurous and creative bloggers started blogging from their mobile devices. The word moblog was thus coined, referring to blogging from a mobile device (mobile phones, PDAs, etc.).

If blogging without a computer is convenient, moblogging with a camera phone is exciting. In just a few clicks you can snap a quick shot and add a few punch lines, and minutes later the neatly formatted post on your personal blog can be shared with the entire world! Figure 1-53 shows a snapshot of O'Reilly editor Brian Jepson's moblog. You can see Brian's world through pictures taken from his phone camera and comments that captured his instantaneous thoughts. (The dry spell between November and March? That's when Brian used a phone without a camera for a few months before switching back to his Nokia 3650.)

There are two major approaches to moblogging, regardless of the myriad phone models and their different capabilities: SMS moblogging and email moblogging. This hack introduces and compares these two methods, with an emphasis on the latter.

Instead of email, you can also use MMS to post blog entries from your camera phone. The MMS message is sent to an email address, and hence, MMS moblogging is essentially the same as email moblogging.

 

1.19.1. SMS Moblogging

SMS moblogging works on any handset that can send SMS, which is virtually every mobile phone nowadays. You write the blog entry on the mobile phone and send it via SMS to a service phone number provided by a moblog service. The moblog service interprets the received SMS message and posts it to your blog. You can be identified by the caller ID or an ID code embedded in the SMS message. A good example of such an SMS moblog service is Txtsolutions (http://blog.txtsolutions.com). Txtsolutions can host your blog on its own site, or post your blog entries to your account in a list of supported third-party blog hosts.

Figure 1-53. An example photo moblog from Brian Jepson

If the SMS moblog service posts the blog entries to a third-party blog host on your behalf, it needs to know your login information on that third-party site.

Despite the meager prerequisite of the handset, SMS moblogging has some major drawbacks. First is the nagging 160-character limitation for SMS. Second, even if you are laconic enough to squeeze each of your posts into fewer than 160 characters (not words), SMS moblogging is text-only. Third, you need to pay extra to the SMS moblog service provider. For example, Txtsolutions charges £0.10 for each message. This charge is in addition to your regular SMS fee (from your wireless operator) and cost for the blog hosting service if it applies.

1.19.2. Email Moblogging

If your mobile phone supports sending email or MMS, email moblogging doesn't have any of the drawbacks of SMS moblogging:

  • There is no practical length limitation, as long as your thumbs don't complain.
  • You can post photos from a camera phone, adding richness to your post.
  • There is no extra charge besides what you pay for the wireless data and regular blog hosting service.

Email moblogging works in much the same way as its SMS counterpart, except that you send email from the phone to a (hopefully) secret email address. The email Inbox is polled by the moblog service at regular intervals (e.g., every five minutes). When a new message is detected, the moblog service retrieves the message and parses the content. If the moblog service supports picture attachments (most do), you can even have a mobile photo blog!

It is important that you keep the email address private. Any message sent to that email address will be automatically posted on your blog.

The easiest way to set up an email-based moblog is to use a blog hosting service that supports email posting. It typically takes only a few minutes. After you open a regular blog account at the hosting service, there is usually a field under the user preferences screen where you can set the private email address. All emails sent to this address will be posted to the blog you just opened.

Most popular blog hosting providers now support email posting from mobile phones, either free of charge (e.g., Blogger) or with a premium paid account (e.g., LiveJournal). Table 1-6 compares several providers that emphasize moblog support.

Table 1-6. Moblog support in popular blog hosting services

Name and URL

Cost (USD/yr)

Photo attachment

Notes

Blogger;

http://www.blogger.com

Free

N

Free email posting feature. No photo attachment support.

LiveJournal;

http://www.livejournal.com

$25

Y

Email posting option available for paid account only. Photo attachments are supported.

TypePad;

http://www.typepad.com

$60

Y

Moblogging feature available for all account types; 50MB storage and 1GB per month bandwidth for basic subscription.

Radio UserLand;

http://radio.userland.com

$40

Y

Cost includes desktop blog software and one year of hosting. Email attachment posting requires additional software; 40MB storage.

Besides the major blog providers, some new providers specialize in moblog hosting. Among them are Textamerica (http://www.textamerica.com) and Fotolog (http://www.fotolog.net). Both of them offer free accounts for users to blog directly from their mobile phones.

The free accounts often come with the condition that the service provider can display advertisements on your blog pages.

 

1.19.3. Photo Moblogging to Any Blog Service

The aforementioned photo moblogging solutions tie you into specific blog hosting services. But in many cases, you do not want this tie-in:

  • You could be running your own blog server and do not use any of the blog hosting services.
  • Your favorite blog host might not provide photo moblogging features.
  • You might not want to pay the extra money to add photo moblogging support.

Is there a service that is free and independent of your blog server? As it turns out there is, and it's called Flickr.

Flickr (http://www.flickr.com) started out as a photo storage provider. The one feature that makes Flickr really interesting from a moblog point of view is that it allows you to upload photos (to Flickr) by email and create a blog entry at your designated blog site. The blog site can be any of the blog hosts mentioned in the previous section, or even your own web site running popular blog server software.

The post includes the email content as its main body and an inline thumbnail, which is linked to the picture stored on Flickr. The thumbnail posting feature in Flickr is really cool and sets it apart from other services, especially if you have a camera phone that produces megapixel pictures. Without resizing to thumbnails, megapixel pictures would clutter up your blog and mess up the web page layout (e.g., sidebars, etc.).

The free account at Flickr allows you to upload up to 20MB of photos per month. A subscription fee of $24.95 per year will push the quota to 2GB per month. Considering most (mobile phone) moblog attachments are smaller than 100KB, the free Flickr account is more than sufficient for even the most aggressive mobloggers. Combining the Flickr email posting service with a free blog hosting service (or your own blog server), you can set up a powerful and free moblog with photo posting in no time!

Figure 1-54 shows the information Flickr needs to post to your blog site on your behalf. Obviously, it needs to know your site address and account credentials.

Figure 1-54. Confirming URL and account credentials of your blog site

Figure 1-55 shows the private posting email addresses Flickr provides to you when you open an account. One address is for adding pictures to your Flickr account, and the other is for adding the pictures and then posting thumbnails to the designated blog.

1.19.3.1. Smart client for Flickr.

The default email application on many phones restricts the size of an attachment to a maximum of 100KB. To get around this limitation and to provide a more integrated user experience, you can use a phone application that takes pictures and then automatically posts them to Flickr without having to switch applications and enter email addresses.

Figure 1-55. The free email address Flickr provides for each account to post blog entries and pictures

Manoj TK wrote a little open source J2ME (Java 2 Mobile Edition) program that does just that. You can download it from http://sourceforge.net/projects/moblogger2/. To learn how the program works, please refer to http://manojtk.blogspot.com/2005/01/smtp-email-attachments-from-nokia-6600.html.

1.19.4. Hacking the Hack

Many power bloggers run their own blogging server so that they can have complete control over the content and presentation of their blog. While Flickr can interoperate with many popular blog systems, it is still a hosted service that is beyond the blogger's control. For instance, there is no guarantee that the free Flickr service won't be replaced by a for-pay service in the future. If you want complete end-to-end control over your moblog, you can customize existing blog server software to make it support email posting with photo attachments from a mobile phone. In this hack, you will learn how to set up the popular WordPress blog server to support photo moblog postings.

Running your own server also gives you complete access to web site visitor statistics, the ability to back up the web site, and many other features.

 

1.19.4.1. Setting up WordPress.

WordPress (http://www.wordpress.org/) is an open source blog server based on PHP and MySQL. It is available free of charge from the WordPress web site. You can run it on your own server or on any ISPserver account that supports PHP4.1 and MySQL 3.23.23 or greater. As a PHP and MySQL application, WordPress runs on almost any modern operating system, including Linux, Unix, BSD, Windows, and Mac OS X.

By following the installation instructions (see http://wordpress.org/docs/installation/5-minute/) you can install WordPress in five minutes. After creating a user account, you can start to post and publish blogs on your very own blog server now! Out of the box, you can use Flickr to post photos to your freshly installed WordPress server. In the rest of this hack, I will discuss how to set up WordPress so that you can moblog with it without needing a third-party service.

1.19.4.2. Email posting with WordPress.

WordPress supports email posting, albeit with two main drawbacks. First, it does not support email attachments. And second, it does not filter the sender's email address. Anyone can send email to the email address and have their messages appear on your blog. Without sender-address filtering, your moblog can be easily flooded with spam messages.

A patch by "lansmash" fixed both drawbacks. Applying the patch is straightforward. First, download the file wp-mail-0.2.zip from the web address http://blade.lansmash.com/index.php?cat=5. Unzip the archive to the WordPress root directory. This adds the files PEAR.php and mimedecode.php to the directory, and replaces the original wp-mail.php file. Now, create two directories, wp-photos and wp-filez, under the WordPress root directory to store images and other attachments, respectively. You can choose other directory names as long as you remember to modify the corresponding settings in the new wp-mail.php file.

If you want automatic picture resizing (an important feature for megapixel camera phones), you need to install an additional hack provided by Hugo. Simply replace the default wp-mail.php file in your WordPress installation with a new file download from http://www.vienna360.net/files/wp-mail.phps.

Now, you can test your setup by sending an email message with a picture attachment to the email address specified in the Options Writing section of the WordPress configuration page. Make sure you enter the correct server and login information. Nothing appears on your blog just yet. That is because the http://your-domain-name/MyMoblog/wp-mail.php.

Of course, if you need to open a browser and load the wp-mail.php script manually every time you post a moblog entry, it defeats the whole point of moblogging. So, let's discuss how to automate the email polling process in WordPress.

1.19.4.3. Setting up email automatic polling.

To automate the email polling and blog posting process in WordPress, you need to schedule a recurring task that loads the wp-mail.php script at fixed intervals (e.g., every five minutes). You need two tools for this: a lightweight URL loader called cURL to load the PHP script, and the open source cron daemon to schedule the recurring URL loading tasks. Both cron and cURL are installed by default on Linux, Unix, and Mac OS X computers. For Windows, you can install the Cygwin toolkit (http://www.cygwin.com/) to get a common set of Unix utilities including cron and cURL.

You can use a fully featured web browser, such as Firefox, to load the wp-mail.php script every five minutes. But that is a huge waste of server resources.

Next, log into your server and type the following on the command line:

	crontab e

This opens the cron control file, which contains all scheduled tasks, in the system's default text editor. You should append one line to the bottom of the file, save it, and exit the editor. cron automatically reloads the control file.

	*/5 * * * * /usr/local/bin/curl http://yourdomain/wp-mail.php > /dev/null

The preceding line in the cron control file schedules the system to run the curl command every five minutes in every year, month, week, and day. That's it! You now have a fully functional photo moblog server.

If you do not want to use the default editor, you can always export the cron control file to a text file, edit it externally, and then import the edited file back to crontab. See the crontab manual for more information.

Haihao Wu


Bluetooth, Mobile Phones, and GPS

Network Discovery and Monitoring

Wireless Security

Hardware Hacks

Software Hacks

Do-It-Yourself Antennas

Wireless Network Design

Appendix A. Wireless Standards

Appendix B. Wireless Hardware Guide



Wireless Hacks
Wireless Hacks: Tips & Tools for Building, Extending, and Securing Your Network
ISBN: 0596101449
EAN: 2147483647
Year: 2004
Pages: 178

Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net