geekery, drawing and then some

Posts about php

More geekery with twitter and flickr stuff

A couple of weeks ago I found and edited a php script to help me post photos to flickr from Tweetie for iPhone (now Twitter for iPhone — do keep up…). After using it for a while I realised the title of the photos got a bit too long for my taste and I spend a little time tweaking. I’ve now changed it so that the first sentence (up to the first . or ! or ?) becomes the title. The rest becomes the description of the photo. For me this works out pretty well.

I added the following lines (changing the last line of my previous tweak to prevent confusion):

$string = preg_replace("/#\w+/i", '', $title);
//previously the above line said: $title pregreplace("/#\w+/ i", '', $title);
if (preg_match("/^.*(\.|\!|\?)/U", $string, $matches)) {
             $title = $matches[0];
             $description = preg_replace("/^.*(\.|\!|\?)/U", '', $string);
else {
      $title = $string;
      $description = "";

right before:

$parameters = array( 'api_key' => API_KEY, 'auth_token' => API_TOKEN, 'tags' => $tags, 'title' => $title, 'description' => $description, );

Note that I also added that last field in there (‘description’). I haven’t completely tested it; however, my limited tests seemed to work fine. I don’t really know much about php, so I probably used more lines than I needed. This way I could keep track of what I did though, and I think I’ll still understand my changes a couple of months from now.