// create a photoset? print 'Create a photoset [y/N] '; if ('y' == substr(trim(fgets(STDIN)), 0, 1)) { $setName = basename($dir); print "Photos will be added to a new photoset named '{$setName}'.\n\n"; } else { $setName = null; print "No photoset will be created.\n\n"; } return $setName; } $api = getApi(); // the idea of this regular expression is that the camera file name // starts with 3 or 4 characters, followed by 4 or 5 digits. if i've // renamed it it would have a space, underscore or hyphen (that we'll // ignore) and then any number of characters before ending with a period // and then 3 character file extension. $pattern = '/\\S{3,4}\\d{4,5}[ _-]?(.*)\\.\\S{3}/'; // the idea of this one is a two digit number, _ or - and then // the name.jpg #$pattern = '/\d{1,2}[ _-]?(.*)\.\S{3}/'; $dir = getDir(); // ... let the user know what we've figured out $user = new Phlickr_AuthedUser($api); $userName = $user->getName(); print "Uploading all the photos in '{$dir}' to {$userName}'s stream\n\n"; $batcher = new CommandlineBatchUploader($dir, $pattern, getSetName($dir)); $uploader = new Phlickr_Uploader($api); $uploader->setTags(getTags()); $uploader->uploadBatch($batcher, new Phlickr_TextUi_UploaderListener()); exit(0);