In my views-list-contenttype.tpl.php i call the (multiy) images uploaded with cck/imagefield with

print $field_image_fid[0]

Is there a way to show only the first image uploaded by the user?
Something like:

print $field_image_fid[0]

Thanks!

CommentFileSizeAuthor
views_0.png45.21 KBdotidentity

Comments

quicksketch’s picture

Try:

$node->content['field_image'][0]['#value'];
bfdexp’s picture

Attempted in the tpl.php with no avail. Any other suggestions. Having same issue?

bfdexp’s picture

Maybe this should be a feature request? In the UI, maybe an option to display the first X amount of images as the teaser?

bfdexp’s picture

Made some minor progress. Found a lot of help here: Drupal Imagecache, Views, CCK, and Imagefields. On this page I found the way to display the image you by it's FID, however it is not as easy as printing the image[0] image[1], ect since the FID is a unique number assigned on a incrementing basis, not on a node basis. So we will have to use some logic to display the first one, two, or three images and it can't be by FID. Unless you do display the first FIDs per node.

A quick fix to the whole problem if you just want to display the first image is to set the following filter: Node: Distinct. This will restrict each node to one distinct field.

Hopefully someone will have a real answer soon....

sun’s picture

Status: Active » Closed (duplicate)

Marking as duplicate of http://drupal.org/node/156528