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?

Files: 
CommentFileSizeAuthor
#34 cck-views-3.patch2.21 KBsijumpk

Comments

dawehner’s picture

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.

ctalley5’s picture

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.

dawehner’s picture

Project: Views » ImageField
Version: 6.x-2.5 » 6.x-3.0

so this is Part of imagefield

quicksketch’s picture

Title: Imagecache Default Images not showing up » ImageField Default Images not showing up in Views
gr4phic3r’s picture

i´m interested too in this

subscribed 0 + 1 = 1

cocoloco’s picture

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.

ctalley5’s picture

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

ctalley5’s picture

Project: ImageField » Views
Version: 6.x-3.0 » 6.x-2.6
dawehner’s picture

Project: Views » ImageField
Version: 6.x-2.6 » 6.x-3.0

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 :)

ctalley5’s picture

haha, oohhh okay I see. Thanks for the explanation! Back to Imagefield we go...

OnkelTem’s picture

So? Have no default images in Ubercart catalog. Nobody cares?

D6, 3.0

quicksketch’s picture

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.

ctalley5’s picture

Status: Active » Fixed

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.

eliza411’s picture

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.

restyler’s picture

Status: Fixed » Active

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.

$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);

sbydrupal’s picture

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.

hefox’s picture

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

$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.

well mannered squirrel’s picture

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

hefox’s picture

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

anrikun’s picture

Works for me, thanks.

yched’s picture

Status: Active » Fixed

re #16, #17, #18 : see #510396: Field info passed to theme functions field only, not field/content type

Thus, closing back this issue.

asak’s picture

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...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

a_c_m’s picture

Status: Closed (fixed) » Active

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.


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.

mbiddlecombe’s picture

subscribing with same problem! Have tried latest cck dev version with hefox's fix but still doesn't work.

a_c_m’s picture

did you try my module based fix?

Marko B’s picture

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.

cyaneo’s picture

Category: bug » support

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.

spylvas’s picture

Category: support » bug

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.

spylvas’s picture

This was permission problem. Solved by giving users permission to view field_image_cache.

cyaneo’s picture

Category: support » bug

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.
Only local images are allowed.http://lh3.ggpht.com/_b6iZZs_jeZU/Sw2pIJzdDCI/AAAAAAAAAiI/CFocUzxy7IY/de...

Johnny vd Laar’s picture

Version: 6.x-3.0 » 6.x-3.2

i'm having the same problem with 6.x-3.2

i have a view that shows fields (not a node view) and that includes an imagefield with a default image. in the node page the default image is shown. on the view the default image is not shown.

yosemite’s picture

same here

image appears as thumb in preview and regular image in node as defined in file_field and imagcache but will not appear when called for in a view. have tried all suggestions above

d 6.16
views 6.10
ImageField 6 3.2

from page created by view where image is supposed to go

sijumpk’s picture

Component: Miscellaneous » Code
Status: Active » Needs review
FileSize
2.21 KB

This is a problem happened due to the cck handler issue while using views 3. Please apply the patch to CCK module. It will solve the issue. :)

dawehner’s picture

@sijumpk

This issue should be solved in 2.x/3.x-dev of cck already.

quicksketch’s picture

Status: Needs review » Fixed

This should be fixed in the latest version of CCK (2.7) that came out today then.

marcoBauli’s picture

Status: Fixed » Active

Open again..still having problems with default image in Views, which show nothing.

Tried all the possible: 'use default image' checkbox is checked, theme('imagecache') call renders default image without any problems, upgraded to latest versions (as of today) of VIews, CCK, imagefield, Filefield. No joy.

Anyone else can please share their findings with latest CCK 2.7? Thx

Mitson’s picture

I edited my post! Sorry for my hasty response.

When Group multiple values in Views settings (in my case it is Defaults: Configure field Content: Photo (field_photo)) is checked then starting from text field must be set to "0" in order to display default image.
It must be remembered that first item is 0!

If I need Views to display second image but node has only one or no image and starting from is set to 1 or more, then nothing is displayed.
I think there must be some type of fallback in these cases.

@marcoBauli
Try to set starting from to 0

marcoBauli’s picture

Mitson, thanks for dropping by.

Unfortunately i am not Grouping multiple values anywhere in the view.

Just displaying a Grid view with the following Fields: Content:Image, Node:Title, Taxonomy:Term

I can attach an export of the View if it can help, still is something very basic.. thx

TomEagle’s picture

Version: 6.x-3.2 » 6.x-3.6
Assigned: Unassigned » TomEagle

I am not sure if I'm posting in the right place, but the symptoms I have are similar, although only in IE. In Firefox and Chrome the imagefield are ok in views.

I am looking at the html and see height="a" width="a" in Only local images are allowed.

Anyone else with the same symptoms?

Using the latest ver. 3.6

quicksketch’s picture

Version: 6.x-3.6 » 6.x-3.7
Assigned: TomEagle » Unassigned

I am looking at the html and see height="a" width="a" in

That was caused by the 3.6 version of FileField. Use the 3.7 version released yesterday. Let's focus on just default images not showing up in Views in this issue.

Mitson’s picture

I will try to explain #39 again about Default images not showing up in Views.

The only case I found is when I use Group multiple values option and starting from sub-option with value set to 1 or more in Views settings (adding Views field -> Content: some_image_field). Then default image never shows in Views.

I'm not sure if this is a bug report or feature request, but it will be very useful if there is a sub-option in Group multiple values. For example checkbox Always display item(s) if item number is less than value set in starting from sub-option. In this way the images will always be displayed even if no (i.e. default image will be displayed).

Mitson’s picture

Hmm, this is perhaps CCK issue, not FileField/ImageField. As far as I see it is in "cck/includes/views/handlers/content_handler_field_multiple.inc".

quicksketch’s picture

Yes, any request regarding multiple values will likely need to be handled by CCK.

Andrew Gorokhovets’s picture

the same problem

Poieo’s picture

Anyone that runs across this, I had the same problem. I re-uploaded my default image which forced the creation of the imagefield_default_images directory which in turn caused the default images to display in views.

AdamGerthel’s picture

I'm having the exact same problem, but in Drupal 7 using core fields

rickh’s picture

Guys i've tried 0 in views and re-uploading. Even uploading a different one then re-uploading my original and nothing. Any ideas?

Summit’s picture

#38 helped me! Why is views not showing images which have an offset more than 0?
Greetings, Martijn

eodonnell’s picture

marcoBauli’s picture

Version: 6.x-3.7 » 6.x-3.10
Status: Active » Fixed

still happening sometimes with latest version of the module when upgrading from 5.x to 6.x. Re-uploading the default picture in the cck field settings seems to fix it.

Setting this to 'fixed' as is a longstanding bug that seems solved for most. Please revert in case.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

RaulMuroc’s picture

Version: 6.x-3.10 » 6.x-3.x-dev
Status: Closed (fixed) » Active

Reverting and should be Versioned do 7.x-1.x-dev because there also exists the problem.

For ex:

I have added a default image into an Image field in a profile and it just does not show up through the views.