associating images with taxonomy terms and teasers?

Events happening in the community are now at Drupal community events on www.drupal.org.
bjc5070's picture

Does anyone know how you can associate icons with taxonomy terms, and have that image show in/or with the teaser on the views page?

I have seen it done (slashdot.org). Dont know how to go about doing that ?

Comments

http://drupal.org/project/tax

marktfrey's picture

http://drupal.org/project/taxonomy_image

I've seen this used in tutorials bit not installed myself. 8000+ installs is a good sign.

In d7 you can add an imagefield to the terms directly through the field ui.

ImageCache + FileField/ImageField

gregoryshearer's picture

In D6 what I do is use CCK to create a new Content Type, say "Photo Gallery Pic". Then use FileField/ImageField modules to add a file upload field for uploading images.

In ImageCache I set up usually two presets, "Thumbnail" and set it up to scale and crop images to the size you want your thumbs to be (100x100 or so) and one like "Full Version" that scales and crops to an image size to the size you want the full version to be. (ImageCache automatically creates resized versions of of any file uploaded via ImageField.)

Set up the View, and when you output the for the "Photo Gallery Pic" content type's image field, the display options it gives you options like "Display ImageCache Thumbnail -> Full Node", and "Display ImageCache Thumbnail -> ImageCache Full Version".

If you install the LightBox2 module it also gives you display options like "LightBox ImageCache Thumbnail -> ImageCache Full Version" which will open the Full Version image in a lightbox.

Thanks! Hope it helps.

Forgot Taxonomy

gregoryshearer's picture

Sorry forgot to mention that once you create the content type, you can go into the Taxonomy configuration and assign vocabularies to that content type. Then as you actually create the pieces of content you can assign them terms, which can then be used for views filters.

Again this is D6.

Greg, I think you miss

bjc5070's picture

Greg,

I think you miss understand what I am asking. I am trying to associate Icons with taxonomy terms. So I have already created my taxonomy vocabs and terms. what I want is an icon that appears with a teaser for every piece of content related to a specific term.

for example: I have a term called "drinks" when content is submitted relating to that term. the teaser that shows up in my views page would have a little Icon of a wine glass incorporated.

I hope that makes sense and I hope anyone else has tried this.

You are right

gregoryshearer's picture

I pretty much answered the inverse of what you were asking. Now I get it and marktfrey's answer makes a lot of sense and I second that and would look at that module. Especially if you want it to be dynamic in terms of adding/changing your terms.

If it does not need to be particularly dynamic you might get away with just rewriting the output of the Views field to hardcode to an icon image outside of drupal. This would be very hackish though. Say your term is "drinks", name your icon drinks.png, then output the field as Only local images are allowed. or whatever the token is for the taxonomy term. That is really basic, but you see where I am going.

The module does sound like the best tip though...

Output it as an img tag

gregoryshearer's picture

It stripped out, "then output the field as <img src="[term].png">"

Basically use the token relating to the term as he imagename in an img tag if it strips things out again.

Apologies for multiple posts. I'm not usually not like that!

I got it working. now im

bjc5070's picture

I got it working. now im trying to do some theming.

Hi I was wondering if you

eurbon's picture

Hi I was wondering if you could please explain the steps that you took to get this working? Am pulling my hair out

For the future

RobW's picture

In D7 this is easy right out of the box. Taxonomies are entities, the first class unit of content in D7, and as such can be fieldable. So just navigate to Structure->Tax->Edit Vocabulary->Manage fields, then add away.

Sweet, sweet D7.

Pittsburgh

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: