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

Problem with loading images through jump.cgi and a question about *.inc.php files

Quote Reply
Problem with loading images through jump.cgi and a question about *.inc.php files
Hi,

i've two questions.
1-I've create the image field in the gliniks_links table, the upload is correctly done(directory/image directory/id/id-imagename.jpg), the entry in the table glinks_links_files is created.
From the admin.cgi panel i can view the image when i am in Database -> Links -> Modify (by clicking on "view", right the image field input area).
So, why it doesn't load the image by the url "jump.cgi?ID=14309&v=ImmagineUp"?
it says "Unknown File requested."
2-I was trying to understand in which path the jump.cgi look for the image, so i wanted to put some "echo" in the jump.inc.php...but i noticed that no changes were apported, neither by commenting the entire page...How does it work?
Quote Reply
Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files In reply to
Hi,

Which version of GLinks/LSQL are you using?

.inc.php files don't exist in anything after 2.2 (AFAIK), so I'm guessing its version 2.1.x --> 2.2 ??)

Do you have an example of how its being called? (i.e so we can see).

BTW, the "jumps" are done via /admin/Links/Users/Jump.pm, not a .php file Smile

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!
Quote Reply
Re: [Andy] Problem with loading images through jump.cgi and a question about *.inc.php files In reply to
I have a 3.2.0 Gossamer Links version...

How it's being called what?The jump.cgi?

The jump.cgi is called in the detailed.html template page like the manual says:
<img src="<%config.db_cgi_url%>/jump.cgi?ID=<%ID%>&v=ImmagineUp">

So the Jump.inc.php and its "PHP" directory is present for some error?It could be...but it's strange that these *.inc.php files share the same folder("Links") of the one you told me to check, "Users"...Mmmmmh...
Quote Reply
Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files In reply to
Hi,

Are you sure you didn't update from an older version of Links SQL ==> GLinks 3.2 ? Cos I just double checked - and tat PHP folder doesn't exist at all on a fresh installation of GLinks 3.2. My guess, is you did an update - and those files were just left there.

Can you send me (email/PM/post it here), a URL to an image that *should* work (so I can see the error message)

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!
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!
Quote Reply
Re: [Andy] Problem with loading images through jump.cgi and a question about *.inc.php files In reply to
Andy wrote:
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;


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

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

Hope that helps.

Cheers

Uh, that's interesting!
In which file i'm supposed to put this code?

but i haven't understood the string called in the template...
i mean...
-$ID is the id of the image or the id of the link?
-'Photo1' and 'Links' what exactly are?
Quote Reply
Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files In reply to
Hi,

That is called a "global" - you put it in Build > User Templates - then scroll to the bottom of the page, and you will see a blank textarea field, where you put the code in (and the name of the global in the text field). Then, save it.

Quote:
but i haven't understood the string called in the template...
i mean...
-$ID is the id of the image or the id of the link?
-'Photo1' and 'Links' what exactly are?

$ID - is the LinkID (you don't need to change this)

Photo1 is the name of the image field you are using. In your case, you would need to use:

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

That should work :) (assuming you have your field setup right).

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!
Quote Reply
Re: [Andy] Problem with loading images through jump.cgi and a question about *.inc.php files In reply to
I'm trying to debug it, it gaves me this error:

Unable to compile 'get_image_url': Global symbol "$table_Files" requires explicit package name at (eval 28675) line 15. Prova-2

so i tried to declare:
$table_Files |= "Links_Files"

i also tried changing "$table_Files" to "Links_Files",

but it gives still the same error...i'll let you know...
Quote Reply
Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files In reply to
Sorry, didn't spot that. Please change:

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

..to:

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

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!
Quote Reply
Re: [Andy] Problem with loading images through jump.cgi and a question about *.inc.php files In reply to
really thank you, it works Smile
Quote Reply
Re: [sbato] Problem with loading images through jump.cgi and a question about *.inc.php files In reply to
Glad to hear it Cool

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!