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 ***************************************************************************/
30 * generate photo thumbnails on the console to avoid webserver overload
34 if(!isset($_SERVER["TERM"])) {
35 print "<br /><br />This script should only be invoked from command line!<br />\n";
39 require_once "phpfspot.class.php";
41 $fspot = new PHPFSPOT;
42 $fspot->fromcmd = true;
47 $short_options.= "h"; /* help */
48 $short_options.= "o"; /* overwrite */
49 $short_options.= "c"; /* cleanup */
51 $long_options = array(
57 /* command line option specified? */
58 if(isset($_SERVER['argc']) && $_SERVER['argc'] > 1) {
60 $con = new Console_Getopt;
61 $args = $con->readPHPArgv();
62 $options = $con->getopt($args, $short_options, $long_options);
64 if(PEAR::isError($options)) {
65 die ("Error in command line: " . $options->getMessage() . "\n");
68 foreach($options[0] as $opt) {
72 print "we need some help here!\n";
77 print "Overwrite flag set!\n";
82 $fspot->cleanup_phpfspot_db();
86 print "invalid option";
93 $all = $fspot->getPhotoSelection();
95 foreach($all as $photo) {
96 $fspot->gen_thumb($photo, $overwrite);