2015-09-09, 23:12:16
No clue what your problem is, works fine for me.
Although I would not use glob if you are not matching patterns or subdirectories.
you can use our
With glob you are going to have to strip the path off to convert to urls with basename() or something
unfortunately there s no native function to convert file paths to urls, you ahve to do that on your own
PHP Code:
function my_get_files(){
GLOBAL $TEMPLATE;
$folder = GSTHEMESPATH . $TEMPLATE . '/assets/images/';
// $folder = GSDATAUPLOADPATH;
print_r($folder."<br/>");
$filetype = '*.*';
$images = glob($folder.$filetype);
debugLog($images);
print_r($images);
}
my_get_files();
PHP Code:
C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/
Array ( [0] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/break.png [1] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/facebook.png [2] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/github.png [3] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/googleplus.png [4] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/icons.txt [5] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/instagram.png [6] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/linkedin.png [7] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/share.png [8] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/tumblr.png [9] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/twitter-alt.png [10] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/twitter.png [11] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/vimeo.png [12] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/youtube.png )
Although I would not use glob if you are not matching patterns or subdirectories.
you can use our
$images = getfiles($folder);
function if you just need 1 folder or our directoryToArray() functionWith glob you are going to have to strip the path off to convert to urls with basename() or something
unfortunately there s no native function to convert file paths to urls, you ahve to do that on your own