Closed (duplicate)
Project:
Image
Version:
5.x-1.x-dev
Component:
image_attach
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Mar 2007 at 10:12 UTC
Updated:
21 Mar 2007 at 19:13 UTC
Hi there,
I had previously asked a question about having an image that was attached to a node appear in a block. The solution that David provided worked fine but... I finally decided to develop the website with Drupal 5.x and the trick does not work anymore.
The code provided was:
$node = node_load(arg(1));
if ($node->iid) {
$image = node_load($node->iid);
print l(image_display($image, 'image_node'), "node/$node->iid", array(), NULL, NULL, FALSE, TRUE);
}
When I use that as a block with Drupal 5.x, the image displays fine when there is an image attached to a node but I get an ugly SQL error on nodes that have no image attached.
Here is the error:
* warning: Invalid argument supplied for foreach() in c:\program files\easyphp1-8\www\modules\node\node.module on line 504.
* warning: implode(): Bad arguments. in c:\program files\easyphp1-8\www\modules\node\node.module on line 508.
* user warning: Erreur de syntaxe pr�s de '' � la ligne 1 query: node_load SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in c:\program files\easyphp1-8\www\includes\database.mysql.inc on line 172.This looks like the error I had previously in Drupal 4.7.x without the "if" statement, which makes me think that the statement does not work with the new version anymore.
Can anyone help?
Thanks a lot!
Caroline
Comments
Comment #1
drewish commentedthis is really a duplicate of an existing feature request. would you mind moving your ideas over there?
Comment #2
drewish commented