$directory = $_SESSION['base_url'] . "assets/images/*.jpg";
$images = glob($directory);
This code is not working. If I print out $directory, it matches the directory where I have put some .jpg files. $images just remains empty…
As bsdnoobz answered, this was my solution:
$directory = dirname(dirname(dirname(__FILE__))) . "\assets\images\\"; //escape
$images = glob($directory . "*.jpg");
It looks like
$_SESSION['base_url']points to your app’s URL (likehttp://example.com). You should use filesystem path instead of URL. Try something like this: