Theory: Streamlining Lightroom and Drupal
For my first technical tutorial post, I'll deal with something I've been using for quite some time now. Lightroom and Drupal.
INTRODUCTION
Adobe Lightroom has export plugins for Flickr and Facebook but what if I wanted to export to my Drupal-based site? To do this, I can think of two options. One, to leverage the LR2/GMail export plugin in Lightroom and Drupal's Mailhandler module or two, to develop a new Lightroom export plugin that will post a new entry in the Drupal site using remote calls. And since I have not started reading the Lightroom SDK guide and I have no idea how to post an entry in Drupal remotely, we can safely crush out option number two.
Note: this is only a theory. I have not been able to successfully set this up because of a module incompatibility and I haven't found a way around it yet.
So what do you need to get this done?
- Familiarity with Lightroom and LR2/Gmail export plugin.
- Familiarity with Drupal and Mailhandler & Mailsave module.
- Able to run Drupal's cron job. This is because Mailhandler is cron-based, I think.
- A custom mail inbox to send the images to. This can be the web mail that your host provides, that is what I'm using. According to documentation, you can use GMail. I'll explain later. Let's call this account "receiver".
- A Gmail account to send the images from. This is important because LR2/GMail needs a GMail account for authentication. Let's call this "sender". Make sure this Gmail account is associated with a username that has post permissions on the Drupal site. This will not work if you do not have permission to create content. It has to be GMail because this plugin is GMail based. Duh.
If you've got all those ready, let's get started. The idea of this theory is that you will export/email the image (including its description and tags for the Drupal node) to receiver using sender account for LR2/GMail export in Lightroom. When the cron is triggered on the Drupal site, Mailhandler retrieves messages from receiver's inbox and uses Mailsave to place the email into CCK fields and post it on your site.
SETTING STUFF UP
1. Create receiver email account
You will want a separate receiver email account because Mailhandler will retrieve messages from this. If you use your normal email address, all your email messages will be posted on your site. You don't want your Facebook and Friendster notifications going public. I used our web host's Web Mail service. According to Mailhandler's documentation, you can use GMail but I didn't test it. This, theoretically, is a good alternative if you can't get your own custom inbox. For our example, let's make the address: "custom_mail_receiver@yoursite.com". Clever.
2. Setup the Mailhandler and Mailsave moduels
As usual, you need to install the modules and configure them on your Drupal installation. I was able to install Mailhandler and test it but currently, Mailsave is incompatible with Drupal 6.14 and I couldn't get it to work. That's why this topic remains a theory for me. Configure Mailhandler to retrieve messages from receiver mail account. For more info on this, you can check Mailhandler's handbook. On Mailhandler's admin page, you will add a new inbox to retrieve messages from. This is where you use the email account we created in Step 1. Make sure you place the correct mail settings. For an example of how this was done, check this howto guide.
3. Setup LR2/GMail in Lightroom.
For a tutorial, see Mr. Friedl's post on managing Lightroom plugins. My hero. For this plugin, you will use the sender account. After setting the three up, you should be ready to post to your Drupal site from Lightroom.
POSTING AN IMAGE AND WHAT HAPPENS
Now that you have the stuff setup, we can logically post to your Drupal website through Lightroom. When exporting to LR2/GMail, you will be asked for an email to use to send. Use the sender account and send it to the receiver account which in this example is "custom_mail_receiver@yoursite.com". The subject of the email will become the post title and the email body will become the entry's text body. Once you're done entering data, click Export.
I'll try to explain what happens next to the best of my knowledge of the interwebz and Drupal. When you click Export in Lightroom, the LR2/GMail packs up your image and uses the sender account to send it to receiver account. The moment the Drupal runs its cron jobs, Mailhandler will access the receiver account and retrieve all messages. With Mailsave, it will treat image attachments as a CCK field. Using all these data, Mailhandler will create a new post on your site.
Since the image passes through GMail and to the receiver account, it may take some time before it actually arrives in the receiver inbox. On top of that, Mailhandler is cron triggered so even if it arrives in the receiver inbox, the message will have to wait until Mailhandler picks it up during cron. There is a substantial delay in this method but that beats having to export the image to a file, visiting your site and creating the post, right?
- ‹ previous
- 69 of 146
- next ›






Yo. I am Roger Casaliñas Jr, better known as radj. I'm from Cebu and I am a full-tiime software engineer working at