Hi all, to improve the handling of the site, i try to have a field for uploading a pic for every cat.
The problem now is to show it.
For links i use this:
my ($rec) = @_;
my $id = $rec->{ID};
if ($rec->{File1}) {
my $links_db = $DB->table('Links');
my $fh = $links_db->file_info( 'File1', $id );
my $location = $fh->File_RelativePath;
if ($fh->File_Name =~ /\.(jpg|gif)$/) {
return qq~ <img src="/imgup$location"> ~;
}
else {
return "Invalid file name.";
}
}
else {return "";}
}
So i have to change the db and the name of the column.
But what´s with
my ($rec) = @_;
my $id = $rec->{ID};
is it $rec ?
then $rec->{what} ?
Robert
The problem now is to show it.
For links i use this:
Code:
sub { my ($rec) = @_;
my $id = $rec->{ID};
if ($rec->{File1}) {
my $links_db = $DB->table('Links');
my $fh = $links_db->file_info( 'File1', $id );
my $location = $fh->File_RelativePath;
if ($fh->File_Name =~ /\.(jpg|gif)$/) {
return qq~ <img src="/imgup$location"> ~;
}
else {
return "Invalid file name.";
}
}
else {return "";}
}
So i have to change the db and the name of the column.
But what´s with
my ($rec) = @_;
my $id = $rec->{ID};
is it $rec ?
then $rec->{what} ?
Robert