How do I print only 1 and the first value of multiple imagefield ?

and how do I print all the values of a multiple imagefield ?

I have this currently:

$picture = theme('imagecache', 'standard_thumbnail', $field_p_image[0]['filepath']);
print $picture;

which worked fine until I added more than 1 image.. please help ?

Comments

syawillim’s picture

I have added this to the node template for the content type to get the first image.

<?php if ($node->teaser):?>
      <?php print "<div>" .$node->field_images[0]['view'] . "</div>"; ?>
	 <?php endif; ?>

All images should display in full node view.

Example at livingexpat.com, but I use JQuery Gallery on full node view.

Diegen’s picture

Yes Im using that to print the first image in node-[name].tpl.php, now Im using $picture = theme('imagecache', 'large_thumbnail', $field_p_image['0']['filepath']; to get first or whichever number.. but the problem is how to get them all. I usually would use this snipper:

<?php
foreach((array)$field_images as $imageview) {
   $output .= "<div class='slideshow-content'>";
      $output .= $imageview['view'];
   $output .= "</div>";
}

print $output;
?>

which is not working at all, just gives me image-name with a small image icon (generics).

SO I try this:

<?php 
$picture = theme('imagecache', 'image_post', $field_p_image[0]['filepath']);
    foreach((array)$field_p_image as $picture) {
        $output .= $picture['view'];
}	
print $output;
?>

hmm not working. ???? I want to retrieve all the values of the imagefield and print theme via imagecache.

Diegen’s picture

I set "Display Fields" to the imagecache preset. That worked. Am I doing it right ? Feels like all this should have been done with views instead of in the node.tpl