Hi,
Something like this is probably more simple =)
1) Add a new global, called "load_image_url". Put the following in it;
my ($ID,$col) = @_;
# make sure a fieldname and ID are provided...
if (!$ID || !$col) { return qq|You need to define the ID and fieldname.|; }
my $schema = $DB->table('Links')->cols;
my $path = $schema->{$col}->{'file_save_url'};
$path =~ s,/$,,;
my $tbl = $DB->table('Links');
my $fh = $tbl->file_info( $col, $ID );
my $rel_path;
if ($fh) {
$rel_path = $fh->File_URL;
} else { return ''; }
undef $fh;
$rel_path =~ s|([^\/]+)$|GT::CGI->escape( $1 )|e;
return $rel_path;
}
2) Call with:
<%load_image_url($ID,'Field_Name')%>
<%endif%>
That should do it =)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Something like this is probably more simple =)
1) Add a new global, called "load_image_url". Put the following in it;
Code:
sub { my ($ID,$col) = @_;
# make sure a fieldname and ID are provided...
if (!$ID || !$col) { return qq|You need to define the ID and fieldname.|; }
my $schema = $DB->table('Links')->cols;
my $path = $schema->{$col}->{'file_save_url'};
$path =~ s,/$,,;
my $tbl = $DB->table('Links');
my $fh = $tbl->file_info( $col, $ID );
my $rel_path;
if ($fh) {
$rel_path = $fh->File_URL;
} else { return ''; }
undef $fh;
$rel_path =~ s|([^\/]+)$|GT::CGI->escape( $1 )|e;
return $rel_path;
}
2) Call with:
Code:
<%if Field_Name%> <%load_image_url($ID,'Field_Name')%>
<%endif%>
That should do it =)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!