Images are probably the most frustrating element of working with drupal. Nothing is easy or as you expect it, it's that simple. There are lots of different ways of doing things but none of them are complete enough that you can stay away from custom coding if you want anything beyond the very basics.
After fiddling around for days with the 'views' module to try to get it to display the images that are present in the cityimage nodes with the city they belong to I finally decided to resort to coding the view directly in php. It's ugly and it's not the 'drupal way' but at least I got it to work in a reasonable amount of time.
The images are displayed as thumbnails on the city page and you can then click on them to get the full sized view. Really this bit of code should only need the node id of the current node, the imagecache namespace and the content type of the nodes that carry the images, but we'll leave that for the moment (though I'll be needing this kind of thing more often, so I will come back to this code and clean it up).
The current solution looks like this:
if (arg(0) == 'node' && is_numeric(arg(1))) {
$nid = arg(1);
$result = db_query("SELECT field_image_fid,c.nid from content_type_cityimage as c, {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid WHERE field_city_nid = $nid and r.vid = c.vid and n.status=1");
while ($imagenode = db_fetch_object($result)) {
$file = _imagefield_file_load($imagenode->field_image_fid);
$img = theme('imagecache', 'cityimagetn', $file['filepath']);
print l($img, "node/$imagenode->nid", null, null, null, false, true);
}
}
Which contains way too many hard coded field names and constant strings for me to be happy.
This code snippet is placed in a block which is then only displayed on the cities page.
Also, the image cache module seems to have the habit of placing all the images in a single directory, which will be terribly slow if there are lots of files.