Images are not displayed after 4.4 to 4.5 upgrade. The errors occur because the database field image.image_list was empty after upgrade. The following dirty hack solved the problem temporarily:

    // Hack for the case image_list IS NULL and the correct path is not added to "Only local images are allowed. if($fname=="") $fname = $node->image_path;

Is it a problem in update-image.php (I am using a postgresql database) or a general problem in the module, which do not handle older images / older records in the image table? Anyone an idea?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aam’s picture

I forgotten to show the position of the hacked code fragment... It's on the end of the image_node_content function:

      $fname = $node->image_list[$res][fname];
      // AAM: hack for the case image_list IS NULL
      if($fname=="") $fname = $node->image_path;
    }
    if($rand) {
      $node->body = "<img class=\"image\" src=\"$base_url/$fname?".$rand."\" />". $node->body;
    }
    else {
      $node->body = "<img class=\"image\" src=\"$base_url/$fname\" />". $node->body;
    }
  }
}
aam’s picture

Priority: Critical » Minor

After download of current versions of drupal 4.5.0 and the image module, this problem does not occur anymore....

Anonymous’s picture

hystrix’s picture

Component: Code » image.module
FileSize
464 bytes

The problem was with the update script's included sql for postgres. As discussed in Issue 11057.

The update-image.php script would fail with the following error:

2004-07-28: first update since Drupal 4.4.0 release

warning: pg_query(): Query failed: ERROR:  parser: parse error at or near "(" at character 33
. in /home/awg/public_html/includes/database.pgsql.inc on line 104.

user error: 
query: ALTER TABLE image ADD image_list(carchar(255)) in /home/awg/public_html/includes/database.pgsql.inc on line 121.

ALTER TABLE {image} ADD image_list(carchar(255)) 
FAILED

Not having the table change applied would result in the following error when viewing an image:

ERROR:  Attribute "image_list" not found

Patch against 4.5.0 attached. After patching, you should be able to run the update script. After altering my table by hand, the viewing error went away.

According to the patch handbook, I should not switch the status of this issue to "patch":

If you only have a patch against a prior revisision, then don't assign your issue to Patch status

As the 4.6.0 version of the image module is a complete re-write, it no longer includes the same upgrade script. It is not clear to me why modules don't have their own patch level version numbers so that modules running on older versions of drupal can be maintained. It doesn't make sense for someone running 4.5.2 on postgres to have to hit this snag if the fix is known. But I understand it becomes difficult to support older versions.