I am using taxonomy_image module but in my views most of the images were showing, but some were not. Could not figure out what the cause was, but here is my roundabout way of working around the issue:
- I had a simple node view with a field for Taxonomy: Term image. I copied the default template that views suggested for that specific field (in the views ui click theme information) which in this case is views-view-field--Products--tid-2.tpl.php. The contents were print $output;
- Then I added a preprocess function in my template.php and flushed cache
//Process variables for views-view-field--Products--tid-2.tpl.php.
function themename_preprocess_views_view_field__Products__tid_2(&$vars) {
//if we're missing a result, attempt to load it another way
if($vars['output'] == '' && (module_exists('taxonomy_image')) ){
//View object results
foreach( $vars['view']->result as $row){
//load noad from nid
$node = node_load($row->nid);
//load tid from node
foreach (taxonomy_node_get_terms_by_vocabulary($node, 1) as $y){
//load image from tid
$vars['output'] = taxonomy_image_display($y->tid);
}
}
}
}
This replaces $output in views-view-field--Products--tid-2.tpl.php with an image. For what I was doing, only one image mattered so it is hard coded to take one image from vocabulary 1. Any an idea what the problem was? I have attached a view, though it is just a default field for taxonomy image.
Comments
Comment #1
gregstout commentedI seem to be having the same problem. Some images are not showing up, while other are. I have about 60 items (via nodes) from a view showing on a page. Some of the items have the same taxonomy term with some of them showing the image and some not showing the image. Seems to be consistent - those that do not show it always do not show it. I have double-checked the assignments of the terms, the configuration of the images, etc. All seems to be in order. The error logs all seem clean. Could this be a timeout issue or a memory issue?
Comment #2
rjbrown99 commented+1 on this happening to me as well with Taxonomy Image 6.x-1.6 and Views 6.x-3.0-alpha1.
The images initially display in the view preview (while editing the view, click preview) and they also display on the view output page. After some period of time, they stop displaying on the output page. If you go back into the view and click 'preview' again, it fixes the output page and the images start displaying again. I am not using any type of views caching.
This also happens if I am using a block and not a view.
Here's the PHP code for my block.
Comment #3
rjbrown99 commentedI don't have the 'real' solution, but luxx is on to something with the cache issue.
Here's a stripped down block. I added an if statement whereby if the image does not come back, we flush the cache and then re-set the output. This now works for me such that the images now come up every time.
This is obviously a band-aid to some type of larger issue with caching in the module. I am changing the title as this is not limited to views.
Comment #4
carvalhar commentedi'm having the same problem, although i couldn't make it work with taxonomy_image_flush_caches();
I tried to call it even at my page.tpl but no results.
some images work and some not... i can see them at category_images by ftp and they are listed at taxonomy image page, but some of them simply doesn't list at any views.
Couldn't find a reason..is there a solution?
Comment #5
carvalhar commentedAlso i tried to add an image cache, but it doesn't generate the images.
And i'm sure my permissions are ok.
it's like the taxonomy image updated with an existing term keeping pretending that it doesn't exist...
is it so shy? lol
I have no idea how to fix it.
Comment #6
szb100 commentedsubscribing...
Comment #7
vosechu commentedCan you try this patch and find out if it works for you?
http://drupal.org/node/998600
Comment #8
cpelham commentedOnly some of my images show up. Images for a particular node show in one view and not another view (which is nearly an identical view). I tried the patch recommend in post #7, but it did not solve my problem.
Comment #9
AntiNSA commentedtry increasing your memcache/varnish/php mem ory
Comment #10
petarb commentedGot this issue as well. We seem to have plenty of PHP memory. Recently authored nodes simply refuse to show up their taxonomy images in views. Haven't changed anything except authoring nodes for many weeks, and we are just starting to notice this behaviour...
Comment #11
AntiNSA commentedI dotn know what sort of caching you are using, but I have found it depends on server load and had to really fine tune varnish/memcache/php memory limit... and there was an update to pantheon which helped clear things up. I think it is definately a mempry avaialable issue.
Comment #12
calebm12 commentedHas anyone found a solution to this. Sometimes the images will load, sometimes they wont.