Reputation: 1
is the following ... To trying to retrieve images from a folder eat the native php function glob, only that is returning an empty array ... and I'm passing the full path to the folder function ...
$pasta = get_template_directory_uri() . '/img/projetos/' . get_post_meta($post->ID, 'projeto', true) .'/';
$imagens = glob("$pasta{*jpg,*png}", GLOB_BRACE) or die ("Erro ao acessar $pasta");
Upvotes: 0
Views: 105
Reputation: 27614
You missing to *
any of image file, You are passing full path of folder but you missing to which are file you want to take thats why use *
all jpg
and png
extension file, Try this way,
$pasta = get_template_directory_uri() . '/img/projetos/' . get_post_meta($post->ID, 'projeto', true) .'/';
$imagens = glob("$pasta . "*. {jpg,png}", GLOB_BRACE) or die ("Erro ao acessar $pasta");
Upvotes: 1