views:

57

answers:

1

Hiya,

I'm trying to theme one of my content types, which has images uploaded to each instance using the image attach module.

Using the developer module, I've found the iids value of the uploaded image (eg 305), but i'm having trouble finding out how I can actually display the image in my code. This line outputs the node id of the image which has been uploaded, but how can I then use that?

$image = $node->iids[0];

I've tried using hook_image, but I can't seem to get that working...

Thanks for any help.

A: 

This did the trick...

$nodeid = $node->nid;
$get_image = db_query('
    SELECT p.filepath as imagefilename
    FROM {image_attach} i 
    LEFT JOIN {image} a ON i.iid = a.nid 
    LEFT JOIN {files} p ON a.fid = p.fid 
    WHERE i.nid = %d AND p.filename = "recipe_thumb"', $nodeid);
$obj_image = db_fetch_object($get_image);
$imagefilename = $obj_image->imagefilename;
hfidgen