10 our ($opt_H, $opt_D, $opt_p);
13 my $image_source_dir = shift;
15 my $schema = SMIDDB
->connect("dbi:Pg:dbname=$opt_D;host=$opt_H;user=postgres;password=$opt_p");
17 my @images = glob("$image_source_dir/*");
19 print STDERR Dumper
(\
@images);
21 foreach my $file (@images) {
22 my $image = SMMID
::Image
->new( { schema
=> $schema, image_dir
=> '/home/production/smmid_images/' });
24 my $name = basename
($file);
26 $image->description("This image represents the structure of the smid $name");
27 $image->copyright("This image may be subject to copryight. Please contact the submitter for copyright information.");
29 $image->process_image($file);
32 my $compound_name = $name;
33 $compound_name =~ s/\.png//g;
35 print STDERR
"Compound name = $compound_name\n";
37 my $row = $schema->resultset("SMIDDB::Result::Compound")->find( { smid_id
=> $compound_name });
40 print STDERR
"Compound $compound_name not found... Skipping.\n";
44 my $link_row = $schema->resultset("SMIDDB::Result::CompoundImage")->create(
46 compound_id
=> $row->compound_id(),
47 image_id
=> $image->image_id(),