Title: [Plugin: NextGEN Gallery] calling amount of images within post
Last modified: August 19, 2016

---

# [Plugin: NextGEN Gallery] calling amount of images within post

 *  [swam22](https://wordpress.org/support/users/swam22/)
 * (@swam22)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-39/)
 * Hi,
 * I’m trying to call the amount of images from within a post, and I am using nextgen
   gallery within that post.
 * This is what I have so far, but it doesn’t seem to be working.
 * <?php global $wpdb;
 * $images = intval( $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->nggpictures WHERE
   post_id = $post->ID”) );
    ?>
 * I have code working which can tell me total images on the site, how many galleries
   and how many albums, but I cannot get this working.
 * Thanks in advance.
 * cheers
 * Sam

The topic ‘[Plugin: NextGEN Gallery] calling amount of images within post’ is closed
to new replies.

## Tags

 * [images](https://wordpress.org/support/topic-tag/images/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 0 replies
 * 1 participant
 * Last reply from: [swam22](https://wordpress.org/support/users/swam22/)
 * Last activity: [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-39/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
