with PHP, I need to count all images in a certain directory, given by a variable $filedir, and store this count in a variable $imagecount.
Therefor, I'm using the following:
$fileurl = $file->url();
This variable gives the path to the file's directory like: /mnt/web5/d1/87/52146187/htdocs/bahrain/content/1-pavilion/3-phoenix-dactylifera
$imagecount = count(glob($filedir . '/*.{jpg,jpeg,png,gif}', GLOB_BRACE));
This should count all files of the type jpg, jpeg, png, gif
As a result, I'm always receiving "0" for $imagecount. Does anyone know, what the problem might be? (There are some given image-files in this directory)
Thanks!