Download & Extend

Count the number of images in an unlimited imagefield

Project:ImageField
Version:6.x-3.2
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Is there a way to count the number of images in an unlimited imagefield? I'd like to get that count, assign it to a variable available to views templates, and then use it to apply a custom class depending on what that count may be.

Any help getting the count would be appreciated, thanks!

Comments

#1

Status:active» fixed

Solved with a minimum amount of php knowledge. Oh, learning.

#2

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#3

Status:closed (fixed)» active

What was your solution?

#4

Status:active» closed (fixed)

Here is a link to a solution for this problem http://drupal.org/node/879652 using the computed fields module.

I used the following to store the value in the database and had to resave my current nodes.

Data Type: Int
Data Length: 10
[ ] Not NULL
[x] Sorable

Calling it into a custome template required

<?php print $node->field_computedname[0]['value']; ?>

Hope that helps.

#5

<?php
$node_field
[0]['value'] = count($node->field_images);
?>

where field_images is the field to count the images of

#6