Hello.

I have a view that outputs a list of nodes and each node may have more than one taxonomy term, even from different vocabularies - how can I output all of these, or select from which vocabulary I want the images to be displayed?

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ErwanF’s picture

Issue tags: +display, +taxonomy, +image, +views, +vocabulary, +duplicate, +taxonomy image, +term image, +different, +tid
FileSize
86.67 KB

Hello,
Same need here (with the same version, 6x-1.6). I'd like to use Taxonomy image as a way to display various little black and white logos (a taxonomy image previously associated to a term) near a photo and some text in a view. But I can only display one logo or twice the same one (please see screenshot) while adding another "Taxonomy: Term Image" field. The tid seems to call always the same term, but obviously, I would like to show different thumbnails (from different vocabularies or from a single "thumbnails" vocabulary if the former is impossible) in a single "teaser".
This may comes from the Views module above all, but we were asked to ask you first, so...

ErwanF’s picture

Anyone?

borfast’s picture

ErwanF, I ended up adding a function to template.php to (sort of) achieve what I wanted.

The function takes the output of the "Taxonomy: all terms" views field, which is basically an HTML list of links to each taxonomy term. I break them apart and replace the linked text with the desired image.

Far from perfect, since this should belong in the module itself, but at least it works.

Note: "Tamarind" is the name of the theme I'm working with.

function tamarind_tax_image($subject) {
  $links = explode(', ', $subject);

  $pattern = '/taxonomy\/term\/(\d)/';
  
  $result = array();
  
  foreach($links as $link) {
    preg_match($pattern, $link, $matches);

    $image = taxonomy_image_get_object($matches[1]);
    if ($image) {
      $result[] = l($image->img, $image->term, array('html' => true));
    }
  }
  
  return $result;
}
ErwanF’s picture

Thanks a lot for the "tip", borfast, I'll try that.

ErwanF’s picture

I break them apart and replace the linked text with the desired image.

Please could you explain? How do replace the term name by its image? At the time of writing, I can only display the terme name...

ErwanF’s picture

I didn't manage to make this working. So sad...

borfast’s picture

ErwanF, sorry, I had not yet seen your request for an explanation.

When I say

I break them apart and replace the linked text with the desired image

I mean that I have a "All terms" field, which prints something like <a href="taxonomy/term/5">Books</a>, <a href="taxonomy/term/6">Cars<a>, <a href="taxonomy/term/7">Houses</a> and I break it apart on the commas, which yields an array of individual links, which I then treat as necessary.
The commas are separating the links because that's how I configured the field.

iandreev’s picture

FileSize
6.39 KB

I developed a patch for this module, which is atached to this comment. It allows to display all term images for a given node as a single view field without generating duplicate rows. They are especially frustrating if you use multi-choice vocabularies to tag articles on your site, like me. Tested with drupal-6.14 and taxonomy_image-6.x-1.6.

After applying the patch flush caches so that views will use new field definitions and restart Apache to purge PHP optimizer caches.

Edit your view and add a new field. Choose "Taxonomy: All term images" as a field type. Here you have an option to limit search for images in a given set of vocabularies, similar to the "Taxonomy: All terms" field, and additionally you can choose to display only one image, if more than one are available.

Internally, this field creates two fictious query fields, "all_tid" and "all_tid_all_tids". The latter is an array of image ids and is used internally to render multiple images. The former is the master field and it contains only a single term id for an image. I needed it for compatibility with the "timeline" module, which cannot work with multiple images.

All the best.

manumilou’s picture

Subscribing

manumilou’s picture

Thank you vidkinet for your patch, it is working well. I built it as a module that adds a field All terms image in the views field.
Enjoy

Manu

weblance’s picture

You sir are brilliant! Saved me on this one!

By the way, something with tar that isn't right. I had to open and manually upload each file. Does not extract properly.

weblance’s picture

FileSize
183.58 KB

I have had a strange bug. The module works great but it seems there might be a little glitch. In a grid view, the first item does not show any images. Attached is the error. The images are the hotel amenities icons below the hotel pic. As you can see the first hotel in the grid is not showing any amenities icons.

greta_drupal’s picture

The Taxonomy Image module was a great find (actually a referral from a post for solution); thanks NancyDru. After spending about 6 hours to upload a flag icon for some 300 countries, I was sweating when my views came up flagless; and wondering how to specify which tax term image to display.

So, major thanks to vitkinet and manumilou for whipping up this patch and module! It will be a great addition to the new version of the mod.

Greta

Pls’s picture

I can confirm that this bug with first image is happening, but it seems that it happens in every view style (grid, html list, unformatted). Possible sql bug. Im not a real programmer so cant help here. Hope that this bugfix will not be forgotten. Cheers!

MBroberg’s picture

Is this supposed to be working with relationships?
I have it working when the terms are attached to the primary nodes called for a view, but not in relationships where the terms are attached to a different node and referenced via a node reference CCK field.
The All Terms field works that way, but not the All Terms images.

Great and critical addition to the TI module by the way!

supersteph’s picture

I'm trying to make a views2 slideshow of taxonomy images from a certain vocab. It works fine displaying the terms, but when i try to display the images, i get nothing. any ideas?

i've been searching everywhere and can't find a solution. hope this is an ok thread for this issue!

Ghostthinker’s picture

Hi, I made a patch (against 1.6) to make this work without a seperate module. If anyone is interessted. Haven't tried it with gridview.

Poieo’s picture

+1 to see this included in the module. Very helpful.

intyms’s picture

Status: Active » Reviewed & tested by the community

+1 to see it (patch from #17) included in the module.

The new views field "Taxonomy All Terms Images" is very useful.
Thanks a lot for all contributors.

intyms’s picture

here is another issues #493150: New Views Field: All Associated Taxonomy Images.
There is also a patch which, i think, gives us the same functionality.
Can anybody review both patches and tell us which of them is better for commitment?

intyms’s picture

FileSize
58.54 KB

i attache the patched module (i patched manually the dev version from 2010-May-03).

intyms’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
23.69 KB

The patch from #17 works fine if we use only one "Taxonomy All terms Images" field inside of our views.

But if we add 2 "Taxonomy All terms images" fields then the settings from the second field will override the settings of the first field.
See attached file.

awakenedvoice’s picture

Subscribing

AntiNSA’s picture

subscribe

lucascaro’s picture

Just tried patch #17 and wanted to say thank you! it seems to work perfectly with 6.x-1.6

bisonte_biscottato’s picture

same error of #22. Impossible to show two or more All terms image field.

OFF’s picture

#21 Module works perfect!

gaintsev’s picture

Many thanks to all!

makt’s picture

Thank you #21! Makes life so much easier when things work perfectly!

mplewis’s picture

I installed the patch from #21, but when I try to add a "Taxonomy: All Terms images" field to my View, I get the following error:

Error: handler for term_image > all_tid doesn't exist!

When I hit the cancel button, I end up with:

Broken/missing handler: term_image > all_tid

I'm running Drupal 6.17 with Views 6.x-2.11.

UPDATE: I reverted back to Taxonomy Image 6.x-1.6 and installed the separate module from #10, and everything is working nicely now. Thank you!

jofdesign’s picture

Thank you it works for me.

I wonder if I could access the value returned by the field from a page.tpl.php or page-taxonomy-term.tpl.php, and exclude the field from the display in the view; so I can display the image out of the embed view.
I tried to use the template_preprocess_views_view_field in my template.php. But I don't know how to get further with this.
Thank you.

baff’s picture

#10 works for me - thanks

neillodwyer’s picture

Thanks to everyone who contributed to this patch. It work a treat. Very helpful indeed.

ekes’s picture

Patch on #493150-22: New Views Field: All Associated Taxonomy Images working, doesn't suffer settings bug above, does seem to re-use more of the views class (and still works as of this moment with views 3).

AntiNSA’s picture

when can this be rolled into working dev? this works great for me w/views 3

NancyDru’s picture

Does Views 3 even have a full official release yet?

The status here is "needs work" and I'd like to see RTBC.

newnewuser’s picture

Hi all,
I am new to drupal. My hosting doesn't allow me to patch. Can anyone suggest how can I get the patch to enable All Term Image to work? Really appreciate if anyone can help!!

newnewuser’s picture

#37 You may want to try http://bri-space.com/content/how-patch-drupal-module-windows
I used it for another patch, but due to version incompatibility, it didn't work for me. But it may work for this patch.

Here's another thread of patch for windows... http://drupal.org/node/23844

AntiNSA’s picture

Any way to get this patch on the newest version as there is a securiy update on this module?

apaderno’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)
Issue tags: -display, -taxonomy, -image, -views, -vocabulary, -duplicate, -taxonomy image, -term image, -different, -tid

I am closing this support request, since it has been opened for a project version that isn't supported anymore (as Drupal 6.x isn't anymore supported.)

perkotek’s picture

Impossible to show two or more All terms image field.x ray cihazı