4 /***************************************************************************
6 * phpfspot, presents your F-Spot photo collection in Web browsers.
8 * Copyright (c) by Andreas Unterkircher
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 ***************************************************************************/
26 if(!isset($_SERVER["TERM"])) {
27 print "<br /><br />This script should only be invoked from command line!<br />\n";
31 require_once "phpfspot.class.php";
33 $fspot = new PHPFSPOT;
34 $fspot->fromcmd = true;
39 $short_options.= "h"; /* help */
40 $short_options.= "o"; /* overwrite */
41 $short_options.= "c"; /* cleanup */
43 $long_options = array(
49 /* command line option specified? */
50 if(isset($_SERVER['argc']) && $_SERVER['argc'] > 1) {
52 $con = new Console_Getopt;
53 $args = $con->readPHPArgv();
54 $options = $con->getopt($args, $short_options, $long_options);
56 if(PEAR::isError($options)) {
57 die ("Error in command line: " . $options->getMessage() . "\n");
60 foreach($options[0] as $opt) {
64 print "we need some help here!\n";
69 print "Overwrite flag set!\n";
74 $fspot->cleanup_phpfspot_db();
78 print "invalid option";
85 $all = $fspot->getPhotoSelection();
87 foreach($all as $photo) {
88 $fspot->gen_thumb($photo, $overwrite);