Block shows when imagefield has no images in it. Currently I am using the "show on all pages except" display permission set in the block administration section-- but this doesn't help with new content added by non-admin users.

Is there a pending fix, or a php snippet I could put in the block admin settings?

My issue seems identical to this one: http://drupal.org/node/314168?mode=2&sort=2

Comments

rgammon’s picture

Temporary fix: Add the following to jcarousel_block/includes/imagefield.inc (insert line 27):

/**
   * Kluge added to keep from showing when no image in field
   * @todo switch "field_image", a specific CCK name for my installation, to variable naming the image_field that goes in this block 
   */
  else if ($node->field_image[0]['filepath'] == null) {
    return false;
  }
doomed’s picture

I'm having the same problem on v1.6 .

This wasnt happening before.

But yesterday i upgraded my Drupal installation from 6.9 to 6.10 and then upgraded CCK and a few other modules and since then, i'm having this problem.

doomed’s picture

Category: support » bug

I just updated to the last version (6.x-1.x-dev from March 20th, 2009) and the same thing still happens.

So i applied rgammon's mini-fix and all is well.

I dont like that we have to hardcode the fieldname but at least it works.

Thanks rgammon.

I hope yang_yi_cn looks at this soon :)

yang_yi_cn’s picture

Status: Active » Fixed
Heilong’s picture

Hi,
I have the same problem, I applied the fix but it didn't work as expected.
I have applied on a cck imagefield source of 4 images, when I upload for example just 2 of 4 images using imagefield, in the carousel view I have the 2 images and 2 question marks "?" under safari, because I uploaded only 2 images, and under firefox I have 2 blank squares.
Moreover the thumbnails in the carousel are not fitting in it...
Any ideas ?
Thanks,

doomed’s picture

Which fix have you applied?

rgammon or the new dev version from yang?

As for the thumbnails problem, check the Documentation on this site.

Heilong’s picture

I just applied the new dev version by yang, but it didn't change anything, for the thumbnails fitting problem it's a CSS conflict I guess.

Heilong’s picture

Status: Fixed » Needs work

Just to change the topic status, I tried to fix it but it still didn't...

doomed’s picture

I didnt apply the new version yet, will report later.

About the thumbnails, yes its a CSS thing: http://drupal.org/node/405650

pfismvg’s picture

change the following function in jcarousel_block/includes/imagefield.inc
this fixes this issue without hardcoding the fieldname

function jcarousel_block_imagefield_exists($nid) {
  $field = variable_get('jcarousel_block_imagefield_name', 'imagefield');
  $field_type = variable_get('jcarousel_block_imagefield_type', 'imagefield');

  $node = node_load($nid);
  if (!$node) {
    return false;
  }
  if (!$node->$field) {
    return false;
  }
  $nodefield=$node->$field;
  if (!is_array($nodefield)) {
    return false;
  }
  if (!count($nodefield)) {
    return false;
  }
  if (count($nodefield)==1 && !is_array($nodefield[0])) {
    return false;
  }
  return true;
}
yang_yi_cn’s picture

Status: Needs work » Closed (fixed)

committed, new release rolled.