I have a Javascript object like this:
var count = { table:19, people:39, places_details:84, story_1:18, story_2:6, story_3:11 }
Each item (table, people, etc.) is a directory within my graphics/ directory at the site root. I would like to use PHP to supply the numeric values by counting the JPG images in the corresponding directory. I imagine something like this:
ar count = { table: <?php count(dir("table")) ?>, people: <?php count(dir("people")) ?>, places_details: <?php count(dir("places_details")) ?>, story_1: <?php count(dir("story_1")) ?>, story_2: <?php count(dir("story_2")) ?>, story_3:<?php count(dir("story_3")) ?> }
But need to filter for JPG and return a number. What's the right code?