ImageField Default Images not showing up in Views
ctalley5 - May 13, 2009 - 02:17
| Project: | ImageField |
| Version: | 6.x-3.0 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I'm using Views with Imagecache for images. I have default images set up which work on the node pages, but not when it comes to Views. The nodes with images uploaded show up, and the default image has been created for the imagecache preset.
Anybody else having this problem?

#1
i think you mean imagefield default images
which version of imagefield do you use, i used the current one, and there the default image works well.
#2
Sorry - yeah I meant Imagefield. I'm using the most recent 6x.-3.0. The strange thing, i had it working a while back no problem, i actually had to go out of my way in Views to turn the defaults off. Now that I want them, i can't get it back on a new View. I'm not doing anything different... maybe there is an argument or relationship that I'm missing? So far i have none - only a filter (content type) and Fields (node title & content image preset) with Table style.
#3
so this is Part of imagefield
#4
#5
i´m interested too in this
subscribed 0 + 1 = 1
#6
I'm having this problem as well - but are you sure this problem is in ImageField and not Views? ImageField's job is only to provide a default image, apply filters and serve it, which it is doing correctly outside of views (e.g. if an appropriate image is selected in display fields). However this problem only shows up when being selected from views.
Let me know if you agree so we can post this to the appropriate forum if needed.
Thanks.
#7
I believe it's a Views issue as well, that's where i originally placed the issue... so I will move it bring it back around again and see if anybody else has found out why
#8
#9
i don't think so
the display is handled by the specific views fields handlers, and this is handled by cck with the formatters and imagefield has their formatters for images
you couldn't do anything with views here :)
#10
haha, oohhh okay I see. Thanks for the explanation! Back to Imagefield we go...
#11
So? Have no default images in Ubercart catalog. Nobody cares?
D6, 3.0
#12
I haven't been able to reproduce this problem. I have a view set up with a default image and it displays just fine. If you can provide steps to reproduce the issue from a clean Drupal install (preferably not requiring Ubercart) then I'll reproduce and fix it.
#13
Okay I've got it fixed.
What I did: not much, I completely uninstalled then reinstalled Imagefield & Views (just in case, but afterwards i am convinced it was not Views like dereine previously said).
I think it was "user error" in the end however. After uploading the default image, I think what I did was leave "use default image" unchecked. It may have been my understanding that by checking that would cause it to not use my uploaded default.
So... if anybody else is having this issue.... CHECK the "use default image" after uploading the image.... in the Default image area.
#14
I was having the same problem and following this thread. I had always had "use default image" checked. I just now tried removing the image from the view and adding it back in, and the default image started to appear as expected.
#15
I'm still having problems with rendering default image in my view. 'use default image' checkbox is checked. theme('imagecache') call renders default image without any problems.
Here is the export of the view that can't render the default image. It just renders empty
<div class="views-field-field-image-cache-fid"><span class="field-content"></span </div>I've tried removing of the image field from that view and adding it again, no success.
<?php$view = new view;
$view->name = 'new_products';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'field_image_cache_fid' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'product_new_linked',
'multiple' => array(
'group' => 1,
'multiple_number' => '1',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_image_cache_fid',
'table' => 'node_data_field_image_cache',
'field' => 'field_image_cache_fid',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'created' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'created',
'table' => 'node',
'field' => 'created',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'light' => 'light',
'lamp' => 'lamp',
'transformator' => 'transformator',
'other' => 'other',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'status_extra' => array(
'operator' => '=',
'value' => '',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status_extra',
'table' => 'node',
'field' => 'status_extra',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('distinct', 0);
$handler = $view->new_display('block', 'Блок', 'block_1');
$handler->override_option('items_per_page', 4);
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
?>
#16
Restyler -
I had the same issue, if you havent solved your problem, try this (in case):
I had 2 content types that was using imagefield. I have set the image defaults checked for one of them, and the other content type image defaults was not checked on.
This affects the Views. Looks like Views takes the latest content type modification. After I checked image defaults for both content types, Views shows the defaults now.
Cheers , hopefully this is your problem.
#17
I am having a similar issue, but the symptom is that the all defaults are appearing as same for all conent types even when set differntly
backtracking it could be the call in cck's content_handler_field on line 18 where it called content_fields with field name but NOT content type, so it it not retrieving the correct field info for the field+content type
A quickie "let's hack cck yay" was to add
<?php$field = content_fields($this->definition['content_field_name'],$values->{$this->aliases['type']});
?>
to like 173 to load up the correct field info for that content type.
didn;'t want to due it earlier in case it screws up something. might still screw up something, but appears to be working so far.
#18
I have the same issue as hefox's here.
I have several views page filtering nodes by content type. Each content type has its own default image. Everything works well in each node but in Views, the same default image shows up for all views page.
Will try hefox's quick fix
#19
I realized I didn't give enough specificity (It was late =/)
The file in question was content_handler_field.inc under cck/includes/views/handlers/, same line number, which is Inside the render() function before it's sent out to be formated.
Not sure if this is a cck bug or not, didn't see anything in cck issue queue
#20
Works for me, thanks.
#21
re #16, #17, #18 : see #510396: Field info passed to theme functions field only, not field/content type
Thus, closing back this issue.
#22
I'm having the same issue, but don't have the field displayed at more then one content type, so not really sure what's going on.
Another thing i found, is this imagecache removes the default image i'm placing...
I'll investigate some more - but this is strange...
#23
Automatically closed -- issue fixed for 2 weeks with no activity.
#24
I ran into this as well... this is as far as we have gotten in trying to fix it - close, but still a little way to go.
<?php
function MODULE_preprocess_views_view_fields(&$vars) {
$field = 'field_primary_image';
// Setting a default image
if (!empty($vars['fields']) AND $vars['fields'][$field .'_fid']->content == NULL) {
$handler_field = $vars['view']->display[$vars['view']->current_display]->handler->handlers['field'][$field .'_fid'];
$imagecache_preset = $handler_field->options['format'];
// Trim off the final _blah
$imagecache_preset = substr($imagecache_preset, 0, - (strpos(strrev($imagecache_preset), '_')+1));
// Find the parent node type
if (!$handler_field->relationship) {
// No relationship
$type = $vars['view']->result[0]->node_type;
}
else {
// Work out the parent from the relationship
if ($handler_field->relationship) {
foreach ($vars['view']->display[$vars['view']->current_display]->handler->handlers['relationship'] as $rel) {
if ($rel->alias == $handler_field->relationship) {
$type = $rel->options['type'];
}
}
}
}
// Get the default image
$default_image = cnp_default_imagefield($field, $type);
// Set the image.
if ($default_image) {
$vars['fields'][$field .'_fid']->content = theme('imagecache', $imagecache_preset, $default_image['filepath']);
}
// DEBUG // dsm(array($vars['fields']['title']->content, $type, $field, $imagecache_preset, $default_image['filepath'], $vars['fields'][$field .'_fid']->content));
}
}
function MODULE_default_imagefield($field, $content_type) {
$sql = 'SELECT widget_settings FROM {content_node_field_instance} WHERE field_name = "%s" && type_name = "%s"';
$result = db_result(db_query($sql, $field, $content_type));
$data = unserialize($result);
return $data['default_image'];
}
?>
thanks to psynaptic for getting a foothold on this.
#25
subscribing with same problem! Have tried latest cck dev version with hefox's fix but still doesn't work.
#26
did you try my module based fix?
#27
I am having similar problem. In view when i have list of all nodes (row style is field) default image doesnt appear, but on node it does. Could this be view problem afterall?
p.s.
acm i tried fix, but doesnt help. still no image in views.
#28
Similar to me - the default image does not shown in ubercart product list, but is visible on the node page and on the "related product" box.#29
I have this problem too. I can see images just fine if I am signed in as a admin, but nobody else can see them. Problem isnt only on ubercart product list, but all the field based views where image field is used.
#30
This was permission problem. Solved by giving users permission to view field_image_cache.
#31
Sorry, but not so at my sites - view "field_image_cache" permission enabled for all users/groups.
All users can see all uploaded images but not the default image given by the default field-settings at admin/content/node-type/product/fields/field_image_cache - this "default image" is nowhere visible.
http://lh3.ggpht.com/_b6iZZs_jeZU/Sw2pIJzdDCI/AAAAAAAAAiI/CFocUzxy7IY/defaultimage.jpg