I use non English word and when there are time that user upload image with no English name, when I display the image it not find the image.
But in the browser it success to display the image.
Is there a way to solve it?
I use Andy global –
my ($ID,$field) = @_;
my $table = 'Users';
# make sure a fieldname and ID are provided...
if (!$ID || !$field) { return "You need to define the ID and fieldname. Example: <\;%Plugins::Thumb_Images::ThumbURL(\$ID,FieldName)%>\;"; }
# get the actual path to where the file is/will be saved...
my $schema = $DB->table($table)->cols;
my $path = $schema->{$field}->{'file_save_url'};
$path =~ s,/$,,; # get rid of trailing / at end of $path
# now we have the highest ID, lets get the image stuff for this link.
my $col = $field; # column name where file is held
my $tbl = $DB->table($table);
my $fh = $tbl->file_info( $col, $ID ); # return a glob reference to the file that you can print <$fh> if you want
my $rel_path;
if ($fh) {
$rel_path = $fh->File_URL;
} else { return; }
undef $fh; # explicit close of the filehandle for good measure
$rel_path =~ s|([^\/]+)$|GT::CGI->escape( $1 )|e;
return $rel_path;
}
But in the browser it success to display the image.
Is there a way to solve it?
I use Andy global –
Code:
sub { my ($ID,$field) = @_;
my $table = 'Users';
# make sure a fieldname and ID are provided...
if (!$ID || !$field) { return "You need to define the ID and fieldname. Example: <\;%Plugins::Thumb_Images::ThumbURL(\$ID,FieldName)%>\;"; }
# get the actual path to where the file is/will be saved...
my $schema = $DB->table($table)->cols;
my $path = $schema->{$field}->{'file_save_url'};
$path =~ s,/$,,; # get rid of trailing / at end of $path
# now we have the highest ID, lets get the image stuff for this link.
my $col = $field; # column name where file is held
my $tbl = $DB->table($table);
my $fh = $tbl->file_info( $col, $ID ); # return a glob reference to the file that you can print <$fh> if you want
my $rel_path;
if ($fh) {
$rel_path = $fh->File_URL;
} else { return; }
undef $fh; # explicit close of the filehandle for good measure
$rel_path =~ s|([^\/]+)$|GT::CGI->escape( $1 )|e;
return $rel_path;
}