Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Adding a different image before each category in the home page

Quote Reply
Adding a different image before each category in the home page
Hi,
I have seen posts for adding a different image before category in the home page, but it was only for old version of Link Sql,
Anyone may have a solution like globals or other solution?
Thanks for your help,
Ali
Ali
Quote Reply
Re: [megaline] Adding a different image before each category in the home page In reply to
Hi,

You could add a field to your Category table with the path to the image. Then in the subcategory.html template I think you should just be able to add this in as a tag where you want the image.
Quote Reply
Re: [afinlr] Adding a different image before each category in the home page In reply to
Hi.

It wouldn't work if the images are uploaded from Admin end as the image is named like xx-imagename.gif etc, whereas the template tag is looking for imagename.gif. Tried this and failed ... like many other users .
Thanks
Anup

Last edited by:

anup123: Aug 14, 2004, 5:46 PM
Quote Reply
Re: [anup123] Adding a different image before each category in the home page In reply to
FTP is simple way to do it, but if you want to upload the images from the Admin and not via FTP you will need to get the Relative path of the images.

Please Note: Using the relative path is very, very slow.

Try this post.
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=182430;search_string=hashed;#182430

Regards

minesite
Quote Reply
Re: [minesite] Adding a different image before each category in the home page In reply to
Hi.

This is what got it going:

sub {
my $tags = shift;
my $file = $DB->table('Category')->file_info('Image', $tags->{ID}) or return "ID $tags->{ID} does not have a file attached.";
return $file->File_RelativePath();
}

However, in template

<img src="<%build_images_url%>/default<%cat_images%>" border=0>

the image url is fine as :
....../images/default/x/x-imagename.gif

if i use the regular

<img src="<%build_images_url%>/default/<%cat_images%>" border=0>

then in the image url on page (visitor side) there is an extra / like:

..../images/default//x/x-imagename.gif

though the images are properly displayed in both cases... Is it because of the leading slash being added to file_info() by default?

But Yes the images uploaded thru Admin are displayed correctly though.
Thanks for pointing me to the thread. As for speed, with static mode is what i prefer over dynamic one, that should not cause any big difference or will it? It could perhaps be made a bit faster if the height and width attributes of the image could also be defined...

Thanks
Anup

Last edited by:

anup123: Aug 14, 2004, 11:02 PM
Quote Reply
Re: [anup123] Adding a different image before each category in the home page In reply to
Hi anup

Glad you got it sorted.

Not sure how it will perform in your case.

I was using it to serve images for links on Dynamic detailed pages and it was extremely slow.

I ended going with one of the thumbnail plugins.

Regards

minesite
Quote Reply
Re: [megaline] Adding a different image before each category in the home page In reply to
 
add an image field to your column table.

make a new global below called "catimage" with code...

Code:
sub {
my $tags = shift;
my $file = $DB->table('Category')->file_info ('Image', $tags->{ID});
my ($url) = $file =~ m,/path/to/your/category/images/(.*),;
return $url;
}

and that should do the trick.

its working for me.

r
Quote Reply
Re: [ryel01] Adding a different image before each category in the home page In reply to
Hi.

Thanks. Using the admin upload and the global posted earlier, i have been able to get it going. In case that breaks for any given reasons under any conditions, i would switch to your suggestion.

How i wish these little bits would be added to resources section which would in a way reduce the load on forum :)

Thanks Again.
Anup
Quote Reply
Re: [anup123] Adding a different image before each category in the home page In reply to
Quote:
How i wish these little bits would be added to resources section which would in a way reduce the load on forum :)

Pugdog/myself has a resource site here;

http://www.sqlwidgets.com

There isn't a huge amount in there... but we can't be expected to do all the work =)

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] Adding a different image before each category in the home page In reply to
Quote:
... but we can't be expected to do all the work =)

Very true.

Unfortunately, it took me days to get to the right thread on this forum for that global by Alex for the Category Image issue. I am still clueless wrt remote_search.cgi so gave it up for the time being. Actually, search on forum sometimes gives scaringly high number of results, with each re also listed in search. Perhaps, to make search more easily navigable would be letting the user have the option whether he would like to have the root thread or the default search results. Imagine 100 threads with 1000 posts being the result of search .... with 10 re's to each thread. Also there is no provision of ordering/sorting the result by Date... so that makes it a journey back and forth between 1999 to 2004 :).

And not being my global ( i can't do one), i cannot post it anywhere meaningful.
After having spent years managing 80T UHP EAF, learning perl seems to be not my cup of tea. Yes i can express the Algorithm in simple english :)

Thanks
Anup
Quote Reply
Re: [anup123] Adding a different image before each category in the home page In reply to
True... but its not as easy as it looks =)

Even after someone submits a global/hack/mod, I still have to go through it, check it, and then format it correctly for the site (can take 30 mins per global, sometimes more).

When I get some time, I'll try and "push" to get some added.

If anyone is interested in being given Editor rights on the site, then I'd be happy to talk to you about that =)

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: [minesite] Adding a different image before each category in the home page In reply to
Hi,

I have actually set up a system like this in subcategory.html :

<IMG SRC="<%build_images_url%>/category_images/<%ID%>.gif" width="20" height="20">

(where ID is the category ID)

Obviously this has drawbacks if you modify the category structure but I think it may be better on server processes since the URL for the image wouldn't have to be called from the database each time.

At the moment I am using an image instead of the name of the category in text.

However I was wondering if anybody knew how I can get "3" images per row as opposed to two the way the home page is built at the moment ? Blush

At the moment a table is built per category within a table that has "2" columns and then "n" number of rows until there are no more categories. Does anybody know how to get "3" columns by "n" number of rows.

Thanks, John
Significant Media

Last edited by:

Jag: Oct 14, 2004, 7:06 PM
Quote Reply
Re: [Jag] Adding a different image before each category in the home page In reply to
Admin
Setup>Build Options

build_category_columns

Fill up whatever number of columns that you would want. That would i think be applicable to all pages

HyTC


Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================
Quote Reply
Re: [HyperTherm] Adding a different image before each category in the home page In reply to
Nice one. That works great. Just what I wanted. Smile

Thanks a lot

John
Significant Media