Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Add image to category - url to display it

Quote Reply
Add image to category - url to display it
Hi,
I have added a field image o Category, and I woiuld o disaply the image in the links pages together with the title and the description of the category.
I have inserted the following link in category.html template
<a href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&view=image"> which works to display images in associated to link, but here it dies nont work.
What would be the correct url?
Quote Reply
Re: [vercyb] Add image to category - url to display it In reply to
If the new field is called "image" then will be so:
<a href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><%image%></a>

_________________________________________________________________________________________________________________
Web directory and search engine | Dirlist.net Directory - Add your link today.
Quote Reply
Re: [Bigpat] Add image to category - url to display it In reply to
In Reply To:
If the new field is called "image" then will be so:
<a href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><%image%></a>

The name of the file is displayed on the page like logo.gif.
When I click on itI go on the the error page with this message
Unable to find link with id: '2'.
Quote Reply
Re: [vercyb] Add image to category - url to display it In reply to
If you use GL 3.0 or is higher, then the code should be such:

<a href="<%config.db_cgi_url%>/jump.cgi?ID=<%ID%>"><%image%><%endif%>

_________________________________________________________________________________________________________________
Web directory and search engine | Dirlist.net Directory - Add your link today.
Quote Reply
Re: [vercyb] Add image to category - url to display it In reply to
In Reply To:
Hi,
I have added a field image o Category, and I woiuld o disaply the image in the links pages together with the title and the description of the category.
I have inserted the following link in category.html template
<a href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&view=image"> which works to display images in associated to link, but here it dies nont work.
What would be the correct url?

Find this solution on a opst by Alex
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=184526#184526

Add a global called image_name =>

sub {
my ($col, $id) = @_;
return $DB->table('CAtegory')->file_info($col,$id)->File_RelativePath;
}

and then in your category.html template you can put:

<img src="/images/<%image_name('Portrait',$ID)%>">

------
My comments

Where /images is the path as defined in
File Save URL in the image field
Images should not be in a cgi folder in order to be accessed


Quote Reply
Re: [vercyb] Add image to category - url to display it In reply to
Does this mean that the images can't be in the "cgi-script" folder at all? This would mean that I would have to put the images in a folder separate from Goss as my "pages" folder is is my "cgi-script" folder where the script is.