Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files

Quote Reply
Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files In reply to
BTW, rather that doing image showing via jump.cgi, this is a MUCH better solution =)

First of all, create a new global, called "get_image_url", and put the following code in it;

Code:
sub {

my ($ID,$field,$table) = @_;

$table ||= 'Links';

# make sure a fieldname and ID are provided...
if (!$ID || !$field) { return "You need to define the ID and 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

my $image_details = $DB->table("$table_Files")->select( { ForeignColName => $field, ForeignColKey => $ID } )->fetchrow_hashref;

my $id = $image_details->{ID};
my $filename = $image_details->{File_Name};
my $file_url = $image_details->{File_URL}; # this is only the URL/folder

my @cut = split //, $id;
my $folderid = $cut[$#cut];

my $url = "$file_url/$folderid/$id-$filename";


$url =~ s|([^\/]+)$|GT::CGI->escape( $1 )|e;

return $url;

}

Then, in your template.. you can call the image with;

<%get_image_url($ID,'Photo1','Links')%>

Hope that helps.

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!
Subject Author Views Date
Thread Problem with loading images through jump.cgi and a question about *.inc.php files sbato 3964 Jul 29, 2008, 3:51 AM
Thread Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files
Andy 3888 Jul 29, 2008, 5:57 AM
Thread Re: [Andy] Problem with loading images through jump.cgi and a question about *.inc.php files
sbato 3873 Jul 29, 2008, 6:14 AM
Post Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files
Andy 3886 Jul 29, 2008, 6:23 AM
Thread Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files
Andy 3880 Jul 29, 2008, 6:25 AM
Thread Re: [Andy] Problem with loading images through jump.cgi and a question about *.inc.php files
sbato 3848 Jul 29, 2008, 6:33 AM
Thread Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files
Andy 3848 Jul 29, 2008, 6:36 AM
Thread Re: [Andy] Problem with loading images through jump.cgi and a question about *.inc.php files
sbato 3895 Jul 29, 2008, 10:37 AM
Thread Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files
Andy 3876 Jul 29, 2008, 10:42 AM
Thread Re: [Andy] Problem with loading images through jump.cgi and a question about *.inc.php files
sbato 3876 Jul 30, 2008, 1:22 AM
Post Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files
Andy 3844 Jul 30, 2008, 1:28 AM