1 #!/usr/local/bin/perl -w
4 if (!defined($ARGV[0])) {
5 print "Usage: $0 name_of_filelist_file\n";
11 my $conn = Pg::connectdb("dbname=indy user=indy host=192.168.4.8");
12 ( PGRES_CONNECTION_OK eq $conn->status )
13 and print "Pg::connectdb ........... ok\n"
14 or die "Pg::connectdb ........... not ok: ", $conn->errorMessage;
17 open(DUMP,"$dump") || die "can't open dump file $dump";
23 next if (/^$/ || /^\s*$/);
25 # exception liste einlesen...
26 $filename=$basedir.$_;
28 $titel="unklassifiziert";
29 $ort="unklassifiziert";
31 $_ = `/usr/X11R6/bin/identify $filename`;
36 $layout=0; # undefined
37 if ( $img_width>$img_height ) {$layout=1;} # querformat
38 if ( $img_width<$img_height ) {$layout=2;} # hochformat
39 if ( $img_width==$img_height) {$layout=3;} # quadratisch
42 print "making icon: $filename \n";
43 `cp $filename /tmp/iconblob.jpg`;
44 `/usr/X11R6/bin/mogrify -geometry 120x120 /tmp/iconblob.jpg`;
46 print "trying to insert: $filename \n";
49 $oid= $conn->lo_import("$filename");
50 print $conn->errorMessage."\n";
51 print "trying to insert icon\n";
52 $ioid= $conn->lo_import("/tmp/iconblob.jpg");
53 print $conn->errorMessage."\n";
54 $sql="INSERT INTO images (title,date,place,author,to_img_layout,to_img_type,is_classified,to_media_folder,to_img_color,comment,webdb_create,img_width,img_height,image_data,icon_data) ".
55 "VALUES ('".$titel."','20010109','".$ort.
56 "','huh','".$layout."','1','0','3','2','".$comment."',now(),'".$img_width."','".$img_height.
57 "','".$oid."','".$ioid."')";
60 print $conn->errorMessage."\n";